When we create textureprovider, initialize it with the texture if we got it
authorGunnar Sletta <gunnar.sletta@nokia.com>
Thu, 15 Sep 2011 13:28:24 +0000 (15:28 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 15 Sep 2011 13:31:00 +0000 (15:31 +0200)
Change-Id: Ia3ab1a75db947a67c610e664051f73bf84b079c1
Reviewed-on: http://codereview.qt-project.org/5008
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
src/declarative/items/qsgimage.cpp

index cb12c17..8cf8599 100644 (file)
@@ -56,9 +56,8 @@ class QSGImageTextureProvider : public QSGTextureProvider
 {
     Q_OBJECT
 public:
-    QSGImageTextureProvider(const QSGImage *imageItem)
-        : d((QSGImagePrivate *) QSGItemPrivate::get(imageItem))
-        , m_texture(0)
+    QSGImageTextureProvider()
+        : m_texture(0)
         , m_smooth(false)
     {
     }
@@ -75,7 +74,6 @@ public:
 
     friend class QSGImage;
 
-    QSGImagePrivate *d;
     QSGTexture *m_texture;
     bool m_smooth;
 };
@@ -546,7 +544,9 @@ QSGTextureProvider *QSGImage::textureProvider() const
                    && QThread::currentThread() == d->sceneGraphContext()->thread(),
                    "QSGImage::textureProvider",
                    "Cannot be used outside the GUI thread");
-        const_cast<QSGImagePrivate *>(d)->provider = new QSGImageTextureProvider(this);
+        QSGImagePrivate *dd = const_cast<QSGImagePrivate *>(d);
+        dd->provider = new QSGImageTextureProvider;
+        dd->provider->m_texture = d->pix.texture(d->sceneGraphContext());
     }
 
     return d->provider;