From 57473d5d2a7bd6ae3117f61ff29264a1b790bb01 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 19 Jan 2010 15:08:01 +0100 Subject: Fixed y-inverted pixmaps on N900. The QGLPixmapData used default bind options, which means that the pixmap is always flipped up-side-down and rendered with flipping. The opaque pixmaps were uploaded unflipped which caused the bug. Ideally we do not want pixmap flipping so change the default in gl pixmaps and tag it accordingly. Reviewed-by: Samuel --- src/opengl/qpixmapdata_gl.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 1bfb6e3..6d47687 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -252,6 +252,10 @@ QGLPixmapData::QGLPixmapData(PixelType type) { 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 @@ void QGLPixmapData::ensureCreated() const } 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()) -- cgit v0.12