src/opengl/qpixmapdata_gl.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 5 d3bac044e0f0
--- a/src/opengl/qpixmapdata_gl.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/opengl/qpixmapdata_gl.cpp	Fri Feb 19 23:40:16 2010 +0200
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -252,6 +252,10 @@
 {
     setSerialNumber(++qt_gl_pixmap_serial);
     m_glDevice.setPixmapData(this);
+
+    // Set InteralBindOptions minus the memory managed, since this
+    // QGLTexture is not managed as part of the internal texture cache
+    m_texture.options = QGLContext::PremultipliedAlphaBindOption;
 }
 
 QGLPixmapData::~QGLPixmapData()
@@ -340,18 +344,18 @@
     }
 
     if (!m_source.isNull()) {
+        glBindTexture(target, m_texture.id);
         if (external_format == GL_RGB) {
             const QImage tx = m_source.convertToFormat(QImage::Format_RGB888);
-
-            glBindTexture(target, m_texture.id);
             glTexSubImage2D(target, 0, 0, 0, w, h, external_format,
                             GL_UNSIGNED_BYTE, tx.bits());
         } else {
             const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format);
-
-            glBindTexture(target, m_texture.id);
             glTexSubImage2D(target, 0, 0, 0, w, h, external_format,
                             GL_UNSIGNED_BYTE, tx.bits());
+            // convertToGLFormat will flip the Y axis, so it needs to
+            // be drawn upside down
+            m_texture.options |= QGLContext::InvertedYBindOption;
         }
 
         if (useFramebufferObjects())