diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-07-14 14:19:40 (GMT) |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-07-16 14:07:59 (GMT) |
commit | 6d0290b2202d4fc084595ba678c2a2d984392e72 (patch) | |
tree | b12dfb42661cf8743451cc281eca74d96c7ca3a9 /src/opengl | |
parent | 388575b4ce3e8025b425ac3a9d56b9d6c6ea56c8 (diff) | |
download | Qt-6d0290b2202d4fc084595ba678c2a2d984392e72.zip Qt-6d0290b2202d4fc084595ba678c2a2d984392e72.tar.gz Qt-6d0290b2202d4fc084595ba678c2a2d984392e72.tar.bz2 |
Fixed text rendering with the GL2 paint engine.
When copying a glyph image into the glyph cache, garbage appeared in
the glyph cache in the lower part of the destination rectangle. This
happened whenever the glyph image's width was not a multiple of four
bytes. I suppose this is a driver bug (nVidia). As a workaround, I
converted the glyph image to ARGB32 such that the width is guaranteed
to be a multiple of four bytes.
Reviewed-by: Tom
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index bcff29b..2bfbf4a 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -252,8 +252,11 @@ 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 { - mask = mask.convertToFormat(QImage::Format_Indexed8); - glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_ALPHA, GL_UNSIGNED_BYTE, mask.bits()); + // 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()); } } |