From 222a21187c3e3fe4ab6f436f30bde1b1dc0b2212 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 24 Sep 2010 00:22:05 +1000 Subject: Invalidate QStaticText coord cache when texture size changes If the glyph cache texture changes size, the texture coordinate array must be regenerated to point to the correct texture locations. Reviewed-By: Gunnar Sletta --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 2347e66..0426ffd 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1470,7 +1470,7 @@ namespace { { public: QOpenGLStaticTextUserData() - : QStaticTextUserData(OpenGLUserData) + : QStaticTextUserData(OpenGLUserData), cacheSize(0, 0) { } @@ -1478,6 +1478,7 @@ namespace { { } + QSize cacheSize; QGL2PEXVertexArray vertexCoordinateArray; QGL2PEXVertexArray textureCoordinateArray; }; @@ -1542,6 +1543,12 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp // Use cache if backend optimizations is turned on vertexCoordinates = &userData->vertexCoordinateArray; textureCoordinates = &userData->textureCoordinateArray; + + QSize size(cache->width(), cache->height()); + if (userData->cacheSize != size) { + recreateVertexArrays = true; + userData->cacheSize = size; + } } -- cgit v0.12