diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2014-03-05 07:02:12 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-05 13:45:44 +0100 |
commit | f697f3ceb6751cfa04338ac8a62ad54dfadad73d (patch) | |
tree | d81a343cf4b431f78bf6d3972dd845ef76b6006c /src/gui/text/qdistancefield.cpp | |
parent | f99fd06d7d72627dcb92f6093537d64429d0563a (diff) |
Optimize glyph lookups with QFontEngine::glyphIndex(uint)
Change-Id: I56c7e727f3d9b08195f38939106620c744c6eaf0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Diffstat (limited to 'src/gui/text/qdistancefield.cpp')
-rw-r--r-- | src/gui/text/qdistancefield.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index f2b88c4692..17116ee2d0 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -739,20 +739,11 @@ bool qt_fontHasNarrowOutlines(QFontEngine *fontEngine) if (!fe) return false; - const QChar uc(QLatin1Char('O')); + QImage im; - glyph_t glyph; - - QGlyphLayout glyphs; - glyphs.numGlyphs = 1; - glyphs.glyphs = &glyph; - int numGlyphs = 1; - - if (!fe->stringToCMap(&uc, 1, &glyphs, &numGlyphs, QFontEngine::GlyphIndicesOnly)) - Q_UNREACHABLE(); - Q_ASSERT(numGlyphs == 1); - - QImage im = fe->alphaMapForGlyph(glyph, QFixed(), QTransform()); + const glyph_t glyph = fe->glyphIndex('O'); + if (glyph != 0) + im = fe->alphaMapForGlyph(glyph, QFixed(), QTransform()); Q_ASSERT(fe->ref.load() == 0); delete fe; |