some adjustments for the software renderer

This commit is contained in:
Uwe Rathmann 2022-04-11 11:13:47 +02:00
parent 4e8ede8130
commit d42e27af5d
1 changed files with 23 additions and 5 deletions

View File

@ -14,6 +14,26 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickWindow>
namespace
{
class ImageProvider : public QskGraphicImageProvider
{
public:
ImageProvider( const QString& id )
: QskGraphicImageProvider( id, type() )
{
}
private:
static ImageType type()
{
const auto backend = QQuickWindow::sceneGraphBackend();
return ( backend == "software" ) ? Image : Texture;
}
};
}
int main( int argc, char* argv[] )
{
@ -33,12 +53,10 @@ int main( int argc, char* argv[] )
SkinnyShortcut::enable( SkinnyShortcut::Quit |
SkinnyShortcut::DebugShortcuts );
// image provider that falls back to the graphic provider
QskGraphicImageProvider* imageProvider =
new QskGraphicImageProvider( providerId, QQuickImageProvider::Texture );
QQmlApplicationEngine engine( QUrl( "qrc:/qml/images.qml" ) );
engine.addImageProvider( imageProvider->graphicProviderId(), imageProvider );
// image provider that falls back to the graphic provider above
engine.addImageProvider( providerId, new ImageProvider( providerId ) );
return app.exec();
}