Udate mipmaps when QSGPaintedItem's texture has changed.
authorYoann Lopes <yoann.lopes@nokia.com>
Mon, 9 May 2011 15:16:16 +0000 (17:16 +0200)
committerYoann Lopes <yoann.lopes@nokia.com>
Mon, 9 May 2011 15:16:54 +0000 (17:16 +0200)
src/declarative/scenegraph/util/qsgpainternode.cpp

index ee42a38..d3dae11 100644 (file)
@@ -89,6 +89,12 @@ void QSGPainterTexture::bind()
                         GL_BGRA, GL_UNSIGNED_BYTE, subImage.constBits());
 #endif
 
+        if (m_has_mipmaps && !m_mipmaps_generated) {
+            const QGLContext *ctx = QGLContext::currentContext();
+            ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
+            m_mipmaps_generated = true;
+        }
+
         m_dirty_texture = false;
         m_dirty_bind_options = false;
     }
@@ -337,6 +343,9 @@ void QSGPainterNode::setDirty(bool d, const QRect &dirtyRect)
     m_dirtyContents = d;
     m_dirtyRect = dirtyRect;
 
+    if (m_mipmapping)
+        m_dirtyTexture = true;
+
     markDirty(DirtyMaterial);
 }