summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-11-04 14:47:31 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-08 07:43:00 +0100
commit63eae1bd15ea8aa1e4fc460194e34ecb5fc55b3a (patch)
treeaf59cef7a05fffcc04655449ad18371f3719c8ee /src/gui/opengl
parent04f6983979021aecd5c3dbb7cc80f864bb4ee56d (diff)
Fix subpixel positioning support
Move subpixelPositionForX from QTextureGlyphCache to QFontEngine, since some font engines like QFontEngineFT may need a custom implementation or tweak it a little bit. In QRasterPaintEngine::drawCachedGlyphs, do not add aliasedCoodinate to x offset as that will break subpixel positioning. Change-Id: Idbcec617509459b80965220ceb07b17737649bbf Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/gui/opengl')
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index a87c3548de..c1bde757a2 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -1536,12 +1536,13 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
void *cacheKey = ctx->shareGroup();
bool recreateVertexArrays = false;
+ QFontEngine *fe = staticTextItem->fontEngine();
QOpenGLTextureGlyphCache *cache =
- (QOpenGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(cacheKey, glyphType, QTransform());
+ (QOpenGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphType, QTransform());
if (!cache || cache->cacheType() != glyphType || cache->contextGroup() == 0) {
cache = new QOpenGLTextureGlyphCache(glyphType, QTransform());
- staticTextItem->fontEngine()->setGlyphCache(cacheKey, cache);
+ fe->setGlyphCache(cacheKey, cache);
recreateVertexArrays = true;
}
@@ -1565,11 +1566,11 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
// cache so this text is performed before we test if the cache size has changed.
if (recreateVertexArrays) {
cache->setPaintEnginePrivate(this);
- if (!cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
+ if (!cache->populate(fe, staticTextItem->numGlyphs,
staticTextItem->glyphs, staticTextItem->glyphPositions)) {
// No space for glyphs in cache. We need to reset it and try again.
cache->clear();
- cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
+ cache->populate(fe, staticTextItem->numGlyphs,
staticTextItem->glyphs, staticTextItem->glyphPositions);
}
cache->fillInPendingGlyphs();
@@ -1620,11 +1621,11 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type
vertexCoordinates->clear();
textureCoordinates->clear();
- bool supportsSubPixelPositions = staticTextItem->fontEngine()->supportsSubPixelPositions();
+ bool supportsSubPixelPositions = fe->supportsSubPixelPositions();
for (int i=0; i<staticTextItem->numGlyphs; ++i) {
QFixed subPixelPosition;
if (supportsSubPixelPositions)
- subPixelPosition = cache->subPixelPositionForX(staticTextItem->glyphPositions[i].x);
+ subPixelPosition = fe->subPixelPositionForX(staticTextItem->glyphPositions[i].x);
QTextureGlyphCache::GlyphAndSubPixelPosition glyph(staticTextItem->glyphs[i], subPixelPosition);