summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2010-01-19 14:08:01 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2010-01-19 14:08:01 (GMT)
commit57473d5d2a7bd6ae3117f61ff29264a1b790bb01 (patch)
tree3a45d2028a65836d73b8b71f3af30dd745b8d990 /src/opengl
parent437a67eb055c688ea4b778f5cfc9132fe02063c6 (diff)
downloadQt-57473d5d2a7bd6ae3117f61ff29264a1b790bb01.zip
Qt-57473d5d2a7bd6ae3117f61ff29264a1b790bb01.tar.gz
Qt-57473d5d2a7bd6ae3117f61ff29264a1b790bb01.tar.bz2
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
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qpixmapdata_gl.cpp12
1 files 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())