summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2012-07-02 18:15:56 +0300
committerQt by Nokia <qt-info@nokia.com>2012-07-03 00:44:15 +0200
commitfa00407acf2a87ecf920ab620ade31102287092a (patch)
treea99bd599ecb62a1a854a4b537a29994325776b89 /src/gui/text
parentca456f34b0a7c6229f43bb932b3aaa2d15ce8740 (diff)
shapeTextWithHarfbuzz() minor optimization
If the used font engine is of type QFontEngine::Multi, then we already have both the "font engine runs" and the stripped glyph indicies for the kerning -> just call the actual font engine's doKerning() method. If the font engine is not of type QFontEngine::Multi, then we could safely avoid the glyph indicies extra manipulations. Change-Id: Ia8899e6d7beecfd391b050683ac41c21465336e4 Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qtextengine.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index df1e1533fb..6c290e209a 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1123,7 +1123,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
shaper_item.advances = reinterpret_cast<HB_Fixed *>(g.advances_x);
shaper_item.offsets = reinterpret_cast<HB_FixedPoint *>(g.offsets);
- if (shaper_item.glyphIndicesPresent) {
+ if (engineIdx != 0 && shaper_item.glyphIndicesPresent) {
for (hb_uint32 i = 0; i < shaper_item.initialGlyphCount; ++i)
shaper_item.glyphs[i] &= 0x00ffffff;
}
@@ -1136,14 +1136,16 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos, shaper_item.num_glyphs);
moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs);
- for (hb_uint32 i = 0; i < shaper_item.num_glyphs; ++i)
- g.glyphs[i] = g.glyphs[i] | (engineIdx << 24);
-
for (hb_uint32 i = 0; i < shaper_item.item.length; ++i)
shaper_item.log_clusters[i] += glyph_pos;
if (kerningEnabled && !shaper_item.kerning_applied)
- font->doKerning(&g, option.useDesignMetrics() ? QFlag(QTextEngine::DesignMetrics) : QFlag(0));
+ actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFlag(QTextEngine::DesignMetrics) : QFlag(0));
+
+ if (engineIdx != 0) {
+ for (hb_uint32 i = 0; i < shaper_item.num_glyphs; ++i)
+ g.glyphs[i] |= (engineIdx << 24);
+ }
glyph_pos += shaper_item.num_glyphs;
}