summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2009-08-11 14:59:33 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-08-11 14:59:33 (GMT)
commit1c62dc421cf1ae45fe5089674b4d67fd0f1ff529 (patch)
treedc27fc61fe81c9fffe74c2f91a2a5b148eb9e2b1 /src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
parentac174ba05db74eb5928ac5d3408bca201adf29ca (diff)
parent54ad9d0e8527eef9ce027f90d7c0ec1d9051833a (diff)
downloadQt-1c62dc421cf1ae45fe5089674b4d67fd0f1ff529.zip
Qt-1c62dc421cf1ae45fe5089674b4d67fd0f1ff529.tar.gz
Qt-1c62dc421cf1ae45fe5089674b4d67fd0f1ff529.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index a3475c7..3f14fdf 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -261,11 +261,21 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph)
if (mask.format() == QImage::Format_RGB32) {
glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, m_height - c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits());
} else {
- // If the width of the uploaded data is not a multiple of four bytes, we get some garbage
- // in the glyph cache, probably because of a driver bug.
- // Convert to ARGB32 to get a multiple of 4 bytes per line.
- mask = mask.convertToFormat(QImage::Format_ARGB32);
- glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits());
+#ifdef QT_OPENGL_ES2
+ glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits());
+#else
+ // glTexSubImage2D() might cause some garbage to appear in the texture if the mask width is
+ // not a multiple of four bytes. The bug appeared on a computer with 32-bit Windows Vista
+ // and nVidia GeForce 8500GT. GL_UNPACK_ALIGNMENT is set to four bytes, 'mask' has a
+ // multiple of four bytes per line, and most of the glyph shows up correctly in the
+ // texture, which makes me think that this is a driver bug.
+ // One workaround is to make sure the mask width is a multiple of four bytes, for instance
+ // by converting it to a format with four bytes per pixel. Another is to copy one line at a
+ // time.
+
+ for (uint i = 0; i < maskHeight; ++i)
+ glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y + i, maskWidth, 1, GL_ALPHA, GL_UNSIGNED_BYTE, mask.scanLine(i));
+#endif
}
}