From: Paul Olav Tvete Date: Fri, 12 Apr 2013 14:24:47 +0000 (+0200) Subject: Remove slow and buggy sub-image code X-Git-Tag: upstream/5.2.1~803^2~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0360e5ed59813f5d7cb709cc7885d942e5fa2473;p=platform%2Fupstream%2Fqtdeclarative.git Remove slow and buggy sub-image code 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 --- diff --git a/src/quick/scenegraph/util/qsgpainternode.cpp b/src/quick/scenegraph/util/qsgpainternode.cpp index e5cf6b8..97b3500 100644 --- a/src/quick/scenegraph/util/qsgpainternode.cpp +++ b/src/quick/scenegraph/util/qsgpainternode.cpp @@ -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(); }