summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-09-28 04:31:16 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-09-28 04:31:16 (GMT)
commit8de9ec760810fea9c9cfccfe575a4693f2f5c024 (patch)
tree261f870b96120a2e93870918150f68b91e6fd356 /src
parent7a14055269c31a389d895a2fffa1e9d897e1bee3 (diff)
downloadQt-8de9ec760810fea9c9cfccfe575a4693f2f5c024.zip
Qt-8de9ec760810fea9c9cfccfe575a4693f2f5c024.tar.gz
Qt-8de9ec760810fea9c9cfccfe575a4693f2f5c024.tar.bz2
Only repopulate the glyph cache when we know something could have changed
Reviewed-by: Gunnar Sletta
Diffstat (limited to 'src')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 42792ac..6b0d2fa 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1499,9 +1499,22 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
staticTextItem->fontEngine->setGlyphCache(ctx, cache);
}
- cache->setPaintEnginePrivate(this);
- cache->populate(staticTextItem->fontEngine, staticTextItem->numGlyphs, staticTextItem->glyphs,
- staticTextItem->glyphPositions);
+ bool recreateVertexArrays = false;
+ if (staticTextItem->userDataNeedsUpdate)
+ recreateVertexArrays = true;
+ else if (staticTextItem->userData == 0)
+ recreateVertexArrays = true;
+ else if (staticTextItem->userData->type != QStaticTextUserData::OpenGLUserData)
+ recreateVertexArrays = true;
+
+ // We only need to update the cache with new glyphs if we are actually going to recreate the vertex arrays.
+ // If the cache size has changed, we do need to regenerate the vertices, but we don't need to repopulate the
+ // cache so this text is performed before we test if the cache size has changed.
+ if (recreateVertexArrays) {
+ cache->setPaintEnginePrivate(this);
+ cache->populate(staticTextItem->fontEngine, staticTextItem->numGlyphs, staticTextItem->glyphs,
+ staticTextItem->glyphPositions);
+ }
if (cache->width() == 0 || cache->height() == 0)
return;
@@ -1513,14 +1526,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
GLfloat dx = 1.0 / cache->width();
GLfloat dy = 1.0 / cache->height();
- bool recreateVertexArrays = false;
- if (staticTextItem->userDataNeedsUpdate)
- recreateVertexArrays = true;
- else if (staticTextItem->userData == 0)
- recreateVertexArrays = true;
- else if (staticTextItem->userData->type != QStaticTextUserData::OpenGLUserData)
- recreateVertexArrays = true;
-
// Use global arrays by default
QGL2PEXVertexArray *vertexCoordinates = &vertexCoordinateArray;
QGL2PEXVertexArray *textureCoordinates = &textureCoordinateArray;