From 414b50fa6f436d04e5d709d337c04a380662bf40 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 4 Jan 2011 15:35:58 +0100 Subject: Fix regression in text rendering in OpenGL2 engine Change 532115bcaa370af827a5cbad017b272842c5aacf introduced a regression by fixing a typo in the QT_OPENGL_ES_2 macro. This caused a broken and untested code path to be used in the GLES2 case. Since the QImage scanlines are 32 bit aligned, QImage::width() cannot be used when copying the data. Rather than pass in bytesPerLine() to the GL function, I opted to revert to the proven behavior, where the pad bytes are never read by GL but each scanline is copied separately, to avoid further regressions on different hardware. This also seems like the more correct approach, as the pad bytes should ideally not be copied into the cache texture. Reviewed-by: Samuel (cherry picked from commit 7a54885b1df9baf793374e3cb9fdf8be93ee7c80) --- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index ba311c3..3aef896 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -293,9 +293,6 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) if (mask.format() == QImage::Format_RGB32) { glTexSubImage2D(GL_TEXTURE_2D, 0, c.x, c.y, maskWidth, maskHeight, GL_BGRA, GL_UNSIGNED_BYTE, mask.bits()); } else { -#ifdef QT_OPENGL_ES_2 - 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 @@ -307,7 +304,6 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) for (int 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 } } -- cgit v0.12