diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2014-01-30 05:46:35 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-30 12:43:33 +0100 |
commit | a5614264d5a5d6d1cc0f2773f4d7cd70195a0546 (patch) | |
tree | 23ce986e78fd6d84e57972be6502fa9ac7f2d7dc /src/gui/text/qrawfont.cpp | |
parent | dca65cd2bc1a999b81df9d45c317a92651db3f82 (diff) |
Get rid of QGlyphLayout::advances_y
...and thus consume 4 bytes less per glyph and increase the performance a bit.
It seems, the only CTFontGetAdvancesForGlyphs() returns both x and y
advances, though y advances are always equal to 0 for horizontal
orientation and x advances are always equal to 0 for vertical orientation.
Also, rename `advances_x` to `advances` for consistency
and declare QGlyphLayout's data size in a single place.
Change-Id: I56b20f893f8a6feb7aa870e3edbca99dd93ba2e2
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/gui/text/qrawfont.cpp')
-rw-r--r-- | src/gui/text/qrawfont.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index b1b910422c..e26f7cdc93 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -568,10 +568,8 @@ bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *adv QGlyphLayout glyphs; glyphs.glyphs = const_cast<glyph_t *>(glyphIndexes); glyphs.numGlyphs = numGlyphs; - QVarLengthArray<QFixed> advances_x(numGlyphs); - QVarLengthArray<QFixed> advances_y(numGlyphs); - glyphs.advances_x = advances_x.data(); - glyphs.advances_y = advances_y.data(); + QVarLengthArray<QFixed> tmpAdvances(numGlyphs); + glyphs.advances = tmpAdvances.data(); bool design = layoutFlags & UseDesignMetrics; @@ -580,7 +578,7 @@ bool QRawFont::advancesForGlyphIndexes(const quint32 *glyphIndexes, QPointF *adv d->fontEngine->doKerning(&glyphs, design ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlag(0)); for (int i=0; i<numGlyphs; ++i) - advances[i] = QPointF(glyphs.advances_x[i].toReal(), glyphs.advances_y[i].toReal()); + advances[i] = QPointF(glyphs.advances[i].toReal(), 0.0); return true; } |