Remove slow and buggy sub-image code
authorPaul Olav Tvete <paul.tvete@digia.com>
Fri, 12 Apr 2013 14:24:47 +0000 (16:24 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 16 Apr 2013 09:35:24 +0000 (11:35 +0200)
The code was probably sub-optimal in most cases, and it broke on
GLES 2 when using the BGRA texture extension.

Done with Gunnar.

Task-number: QTBUG-30656
Change-Id: I92f74cd39f408f145629bc0eb6f3ff43d2f4f000
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
src/quick/scenegraph/util/qsgpainternode.cpp

index e5cf6b8..97b3500 100644 (file)
@@ -73,10 +73,6 @@ QSGPainterTexture::QSGPainterTexture()
     m_retain_image = true;
 }
 
-#ifdef QT_OPENGL_ES
-extern void qsg_swizzleBGRAToRGBA(QImage *image);
-#endif
-
 void QSGPainterTexture::bind()
 {
     if (m_dirty_rect.isNull()) {
@@ -84,33 +80,8 @@ void QSGPainterTexture::bind()
         return;
     }
 
-    bool oldMipmapsGenerated = m_mipmaps_generated;
-    m_mipmaps_generated = true;
+    setImage(m_image);
     QSGPlainTexture::bind();
-    m_mipmaps_generated = oldMipmapsGenerated;
-
-    QImage subImage = m_image.copy(m_dirty_rect);
-
-    int w = m_dirty_rect.width();
-    int h = m_dirty_rect.height();
-
-#ifdef QT_OPENGL_ES
-    qsg_swizzleBGRAToRGBA(&subImage);
-    glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirty_rect.x(), m_dirty_rect.y(), w, h,
-                    GL_RGBA, GL_UNSIGNED_BYTE, subImage.constBits());
-#else
-    glTexSubImage2D(GL_TEXTURE_2D, 0, m_dirty_rect.x(), m_dirty_rect.y(), w, h,
-                    GL_BGRA, GL_UNSIGNED_BYTE, subImage.constBits());
-#endif
-
-    if (m_has_mipmaps && !m_mipmaps_generated) {
-        QOpenGLContext *ctx = QOpenGLContext::currentContext();
-        ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
-        m_mipmaps_generated = true;
-    }
-
-    m_dirty_texture = false;
-    m_dirty_bind_options = false;
 
     m_dirty_rect = QRect();
 }