QImage image;
mutex.lock();
if (!cancelled.contains(runningJob))
- runningJob->postReply(errorCode, errorStr, readSize, image);
+ runningJob->postReply(errorCode, errorStr, readSize, textureFactoryForImage(image));
mutex.unlock();
- } else if (imageType == QQmlImageProvider::Image) {
- QImage image = ep->getImageFromProvider(url, &readSize, requestSize);
+ } else if (imageType == QQuickImageProvider::Image) {
+ QImage image = provider->requestImage(imageId(url), &readSize, requestSize);
QQuickPixmapReply::ReadError errorCode = QQuickPixmapReply::NoError;
QString errorStr;
if (image.isNull()) {
errorStr = QQuickPixmap::tr("Failed to get image from provider: %1").arg(url.toString());
}
mutex.lock();
- if (!cancelled.contains(runningJob)) {
- QQuickTextureFactory *factory = QSGContext::createTextureFactoryFromImage(image);
- if (factory)
- runningJob->postReply(errorCode, errorStr, readSize, factory, image);
- else
- runningJob->postReply(errorCode, errorStr, readSize, image);
- }
-
+ if (!cancelled.contains(runningJob))
+ runningJob->postReply(errorCode, errorStr, readSize, textureFactoryForImage(image));
mutex.unlock();
} else {
- QQuickTextureFactory *t = ep->getTextureFromProvider(url, &readSize, requestSize);
+ QQuickTextureFactory *t = provider->requestTexture(imageId(url), &readSize, requestSize);
QQuickPixmapReply::ReadError errorCode = QQuickPixmapReply::NoError;
QString errorStr;
if (!t) {
{
if (url.scheme() == QLatin1String("image")) {
QSize readSize;
- QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine);
- QQmlImageProvider::ImageType imageType = ep->getImageProviderType(url);
+
+ QQuickImageProvider::ImageType imageType = QQuickImageProvider::Invalid;
+ QQuickImageProvider *provider = static_cast<QQuickImageProvider *>(engine->imageProvider(imageProviderId(url)));
+ if (provider)
+ imageType = provider->imageType();
switch (imageType) {
- case QQmlImageProvider::Invalid:
+ case QQuickImageProvider::Invalid:
return new QQuickPixmapData(declarativePixmap, url, requestSize,
QQuickPixmap::tr("Invalid image provider: %1").arg(url.toString()));
- case QQmlImageProvider::Texture:
+ case QQuickImageProvider::Texture:
{
- QQuickTextureFactory *texture = ep->getTextureFromProvider(url, &readSize, requestSize);
+ QQuickTextureFactory *texture = provider->requestTexture(imageId(url), &readSize, requestSize);
if (texture) {
*ok = true;
- return new QQuickPixmapData(declarativePixmap, url, texture, QImage(), readSize, requestSize);
+ return new QQuickPixmapData(declarativePixmap, url, texture, readSize, requestSize);
}
}
- case QQmlImageProvider::Image:
+ case QQuickImageProvider::Image:
{
- QImage image = ep->getImageFromProvider(url, &readSize, requestSize);
+ QImage image = provider->requestImage(imageId(url), &readSize, requestSize);
if (!image.isNull()) {
*ok = true;
- return new QQuickPixmapData(declarativePixmap, url, image, readSize, requestSize);
+ return new QQuickPixmapData(declarativePixmap, url, textureFactoryForImage(image), readSize, requestSize);
}
}
- case QQmlImageProvider::Pixmap:
+ case QQuickImageProvider::Pixmap:
{
- QPixmap pixmap = ep->getPixmapFromProvider(url, &readSize, requestSize);
+ QPixmap pixmap = provider->requestPixmap(imageId(url), &readSize, requestSize);
if (!pixmap.isNull()) {
*ok = true;
- return new QQuickPixmapData(declarativePixmap, url, pixmap.toImage(), readSize, requestSize);
+ return new QQuickPixmapData(declarativePixmap, url, textureFactoryForImage(pixmap.toImage()), readSize, requestSize);
}
}
}