some adjustments for the software renderer
This commit is contained in:
parent
4e8ede8130
commit
d42e27af5d
|
@ -14,6 +14,26 @@
|
||||||
|
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QQmlApplicationEngine>
|
#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[] )
|
int main( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
|
@ -33,12 +53,10 @@ int main( int argc, char* argv[] )
|
||||||
SkinnyShortcut::enable( SkinnyShortcut::Quit |
|
SkinnyShortcut::enable( SkinnyShortcut::Quit |
|
||||||
SkinnyShortcut::DebugShortcuts );
|
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" ) );
|
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();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue