diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-11-05 20:20:07 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-06 11:31:39 +0100 |
commit | f78661b03cc1affcdd222be50b35d956edac4711 (patch) | |
tree | 235e8214a7c13bc6f6a3cd30e4c1edd4637043b9 | |
parent | 6d45bf683e17092059a553fd31ad2a89672e3195 (diff) |
Make OpenGL texture glyph cache use the right freetype glyphs
The freetype font engine would fall back to rasterizing glyphs
via QPainterPath in QFontEngine::alphaMapForGlyph() which has
a rather unfortunate implementation.
Change-Id: Ic0b4095b6f17ab33f0602139f0a8fb441dfba0ee
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
-rw-r--r-- | src/gui/opengl/qopengltextureglyphcache.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index 061e8f4166..3b62d1d63a 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -303,7 +303,17 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed return; } - QImage mask = textureMapForGlyph(glyph, subPixelPosition); + QImage mask; + + if (m_current_fontengine->hasInternalCaching()) { + QImage *alphaMap = m_current_fontengine->lockedAlphaMapForGlyph(glyph, subPixelPosition, QFontEngine::Format_None); + if (!alphaMap || alphaMap->isNull()) + return; + mask = alphaMap->copy(); + m_current_fontengine->unlockAlphaMapForGlyph(); + } else { + mask = textureMapForGlyph(glyph, subPixelPosition); + } const int maskWidth = mask.width(); const int maskHeight = mask.height(); |