summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-12-10 07:23:16 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-12-10 07:41:53 (GMT)
commitcedb5e0a5bb381ecfe5acc463d96a0c15abe474d (patch)
tree2a4c7d413a5c6d8c34c925207f72083e4726513b /src/opengl
parent373378b7f477190ebcd43ca0372a40f185522b0b (diff)
downloadQt-cedb5e0a5bb381ecfe5acc463d96a0c15abe474d.zip
Qt-cedb5e0a5bb381ecfe5acc463d96a0c15abe474d.tar.gz
Qt-cedb5e0a5bb381ecfe5acc463d96a0c15abe474d.tar.bz2
Missing glyphs in GL when scaling QStaticText and QML text items
Since scaled text is backed by an A8 glyph cache, it needs to repopulate even if it has previously populated the cache for the unscaled text. This means that we need to record in the userData that the type of the cache is not the same as the last time. Otherwise the A8 version of the cache will only be updated when it's created and when the text actually changes, leading to glyphs missing on screen when zooming text using a scale. Task-number: QTBUG-16012 Reviewed-by: Gunnar
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 7045fe9..4a64f39 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1464,6 +1464,7 @@ namespace {
QSize cacheSize;
QGL2PEXVertexArray vertexCoordinateArray;
QGL2PEXVertexArray textureCoordinateArray;
+ QFontEngineGlyphCache::Type glyphType;
};
}
@@ -1489,12 +1490,17 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
cache->setContext(ctx);
}
- if (staticTextItem->userDataNeedsUpdate)
+ if (staticTextItem->userDataNeedsUpdate) {
recreateVertexArrays = true;
- else if (staticTextItem->userData() == 0)
+ } else if (staticTextItem->userData() == 0) {
recreateVertexArrays = true;
- else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData)
+ } else if (staticTextItem->userData()->type != QStaticTextUserData::OpenGLUserData) {
recreateVertexArrays = true;
+ } else {
+ QOpenGLStaticTextUserData *userData = static_cast<QOpenGLStaticTextUserData *>(staticTextItem->userData());
+ if (userData->glyphType != glyphType)
+ 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
@@ -1506,8 +1512,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
// No space in cache. We need to clear the cache and try again
cache->clear();
cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
- staticTextItem->glyphs, staticTextItem->glyphPositions);
- }
+ staticTextItem->glyphs, staticTextItem->glyphPositions);
+ }
}
if (cache->width() == 0 || cache->height() == 0)
@@ -1537,6 +1543,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
userData = static_cast<QOpenGLStaticTextUserData*>(staticTextItem->userData());
}
+ userData->glyphType = glyphType;
+
// Use cache if backend optimizations is turned on
vertexCoordinates = &userData->vertexCoordinateArray;
textureCoordinates = &userData->textureCoordinateArray;