diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2012-01-09 08:43:34 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-13 09:27:22 +0100 |
commit | c3b4d679684434d318c75474f426d5c61a4b239c (patch) | |
tree | 4f512ff74a2ab1fa957db2a123c447156a83df69 /src/quick/util | |
parent | c194b012182c3ae495bb7a740f02a5a9f5b3c3b3 (diff) |
Reintroduce plugin support for asynchronous hardware specific textures
Change-Id: Iad36542d2137e7a6470009c308ece3de389907c1
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/quick/util')
-rw-r--r-- | src/quick/util/qdeclarativepixmapcache.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/quick/util/qdeclarativepixmapcache.cpp b/src/quick/util/qdeclarativepixmapcache.cpp index 006d720a6e..cb29ec649b 100644 --- a/src/quick/util/qdeclarativepixmapcache.cpp +++ b/src/quick/util/qdeclarativepixmapcache.cpp @@ -48,6 +48,7 @@ #include <private/qdeclarativeengine_p.h> #include <QtQuick/private/qsgtexture_p.h> +#include <QtQuick/private/qsgcontext_p.h> #include <QCoreApplication> #include <QImageReader> @@ -64,7 +65,6 @@ #include <QtCore/qdebug.h> #include <private/qobject_p.h> #include <QSslError> -#include <QOpenGLContext> #define IMAGEREQUEST_MAX_REQUEST_COUNT 8 #define IMAGEREQUEST_MAX_REDIRECT_RECURSION 16 @@ -430,7 +430,11 @@ void QDeclarativePixmapReader::networkRequestDone(QNetworkReply *reply) // send completion event to the QDeclarativePixmapReply mutex.lock(); if (!cancelled.contains(job)) { - job->postReply(error, errorString, readSize, image); + QDeclarativeTextureFactory *factory = QSGContext::createTextureFactoryFromImage(image); + if (factory) + job->postReply(error, errorString, readSize, factory, image); + else + job->postReply(error, errorString, readSize, image); } mutex.unlock(); } @@ -529,8 +533,14 @@ void QDeclarativePixmapReader::processJob(QDeclarativePixmapReply *runningJob, c errorStr = QDeclarativePixmap::tr("Failed to get image from provider: %1").arg(url.toString()); } mutex.lock(); - if (!cancelled.contains(runningJob)) - runningJob->postReply(errorCode, errorStr, readSize, image); + if (!cancelled.contains(runningJob)) { + QDeclarativeTextureFactory *factory = QSGContext::createTextureFactoryFromImage(image); + if (factory) + runningJob->postReply(errorCode, errorStr, readSize, factory, image); + else + runningJob->postReply(errorCode, errorStr, readSize, image); + } + mutex.unlock(); } else { QDeclarativeTextureFactory *t = ep->getTextureFromProvider(url, &readSize, requestSize); @@ -564,8 +574,13 @@ void QDeclarativePixmapReader::processJob(QDeclarativePixmapReply *runningJob, c errorCode = QDeclarativePixmapReply::Loading; } mutex.lock(); - if (!cancelled.contains(runningJob)) - runningJob->postReply(errorCode, errorStr, readSize, image); + if (!cancelled.contains(runningJob)) { + QDeclarativeTextureFactory *factory = QSGContext::createTextureFactoryFromImage(image); + if (factory) + runningJob->postReply(errorCode, errorStr, readSize, factory, image); + else + runningJob->postReply(errorCode, errorStr, readSize, image); + } mutex.unlock(); } else { // Network resource |