diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2015-03-07 07:59:06 +0400 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2015-03-12 07:42:58 +0000 |
commit | 69504803a9b73140644f2b746689667edde6a773 (patch) | |
tree | 56f56f60c2822bd7c9f6da22bd9fd2db1ccb9142 /src/gui/text/qfontengine_ft.cpp | |
parent | 08aa2c9297430580fd6bd5c270b9db40b6fde34d (diff) |
[QFontEngineFT] Avoid caching a transformed glyph in defaultGlyphSet
and only cache non-scalable glyphs in defaultGlyphSet
if a requested transform is translation.
Change-Id: I49d936736871bd455e573335c014ddefe8bb915e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/gui/text/qfontengine_ft.cpp')
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index decf17075f..630161ee28 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1334,14 +1334,14 @@ static inline FT_Matrix QTransformToFTMatrix(const QTransform &matrix) return m; } -QFontEngineFT::QGlyphSet *QFontEngineFT::loadTransformedGlyphSet(const QTransform &matrix) +QFontEngineFT::QGlyphSet *QFontEngineFT::loadGlyphSet(const QTransform &matrix) { if (matrix.type() > QTransform::TxShear || !cacheEnabled) return 0; // FT_Set_Transform only supports scalable fonts if (!FT_IS_SCALABLE(freetype->face)) - return 0; + return matrix.type() <= QTransform::TxTranslate ? &defaultGlyphSet : Q_NULLPTR; FT_Matrix m = QTransformToFTMatrix(matrix); @@ -1758,15 +1758,11 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe QFontEngineFT::Glyph *glyph; QScopedPointer<QFontEngineFT::Glyph> glyphGuard; if (cacheEnabled) { - QFontEngineFT::QGlyphSet *gset = &defaultGlyphSet; + QGlyphSet *gset = loadGlyphSet(t); QFontEngine::HintStyle hintStyle = default_hint_style; if (t.type() >= QTransform::TxScale) { // disable hinting if the glyphs are transformed default_hint_style = HintNone; - if (t.isAffine()) - gset = loadTransformedGlyphSet(t); - else - gset = 0; } if (gset) { @@ -1843,15 +1839,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphFor(glyph_t g, const QTransform &t, bool fetchBoundingBox) { - QGlyphSet *glyphSet = 0; - if (cacheEnabled) { - if (t.type() > QTransform::TxTranslate && FT_IS_SCALABLE(freetype->face)) - glyphSet = loadTransformedGlyphSet(t); - else - glyphSet = &defaultGlyphSet; - Q_ASSERT(glyphSet != 0); - } - + QGlyphSet *glyphSet = loadGlyphSet(t); if (glyphSet != 0 && glyphSet->outline_drawing && !fetchBoundingBox) return 0; |