C
Qt Cluster: Rendering and Recovery from Main UI Failure
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
// This file is part of the Qt Safe Renderer module
#include "etcprovider.h"
#include <QFile>
#include <QDebug>
#include <qopenglfunctions.h>
#include <qqmlfile.h>
QImage EtcProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
{
Q_UNUSED(requestedSize);
QImage ret;
QUrl url = QUrl(id);
if (url.isRelative() && !m_baseUrl.isEmpty())
url = m_baseUrl.resolved(url);
QString path = QQmlFile::urlToLocalFileOrQrc(url);
ret.load(path);
*size = ret.size();
return ret;
}
void EtcProvider::setBaseUrl(const QUrl &base)
{
m_baseUrl = base;
}