summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2012-01-23 15:06:41 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-24 17:42:04 +0100
commitaf48e0ba36aed330e8b262687e3192d7e09796f7 (patch)
treef6d67b0c2d871ef169f61d7e0afcc578efefe5f2 /src/opengl
parent601d68584921a47d83d833228f5ec698e13b624c (diff)
Move glyphMargin() to QFontEngine
glyphMargin() support for QTextureGlyphCache is implemented in respective font engines, thus this function is platform dependent. Before Qt 5 the code is guarded in macros like #ifdef Q_WS_MAC, now we should move them into QFontEngine and its subclasses. So far only Windows font engines support it. FreeType and Core Text based font engines all ignore it. Change-Id: Ia14016533d8fbfaacf848a7d3bc928f8197318f5 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 0ae3a18e44..c20a9c1f7a 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1569,11 +1569,12 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
void *cacheKey = const_cast<QGLContext *>(QGLContextPrivate::contextGroup(ctx)->context());
bool recreateVertexArrays = false;
+ QFontEngine *fe = staticTextItem->fontEngine();
QGLTextureGlyphCache *cache =
- (QGLTextureGlyphCache *) staticTextItem->fontEngine()->glyphCache(cacheKey, glyphType, QTransform());
+ (QGLTextureGlyphCache *) fe->glyphCache(cacheKey, glyphType, QTransform());
if (!cache || cache->cacheType() != glyphType || cache->contextGroup() == 0) {
cache = new QGLTextureGlyphCache(glyphType, QTransform());
- staticTextItem->fontEngine()->setGlyphCache(cacheKey, cache);
+ fe->setGlyphCache(cacheKey, cache);
recreateVertexArrays = true;
}
@@ -1597,11 +1598,11 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
// 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();
@@ -1612,7 +1613,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
transferMode(TextDrawingMode);
- int margin = cache->glyphMargin();
+ int margin = fe->glyphMargin(glyphType);
GLfloat dx = 1.0 / cache->width();
GLfloat dy = 1.0 / cache->height();
@@ -1652,11 +1653,11 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
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 = staticTextItem->fontEngine()->subPixelPositionForX(staticTextItem->glyphPositions[i].x);
+ subPixelPosition = fe->subPixelPositionForX(staticTextItem->glyphPositions[i].x);
QTextureGlyphCache::GlyphAndSubPixelPosition glyph(staticTextItem->glyphs[i], subPixelPosition);