From a5614264d5a5d6d1cc0f2773f4d7cd70195a0546 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 30 Jan 2014 05:46:35 +0200 Subject: 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 Reviewed-by: Lars Knoll Reviewed-by: Simon Hausmann --- src/gui/text/qfontmetrics.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gui/text/qfontmetrics.cpp') diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 1a66657cbd..08105834ea 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -546,7 +546,7 @@ int QFontMetrics::width(const QString &text, int len, int flags) const QFixed width; for (int i = 0; i < numGlyphs; ++i) - width += glyphs.advances_x[i]; + width += glyphs.advances[i]; return qRound(width); } @@ -597,7 +597,7 @@ int QFontMetrics::width(QChar ch) const QGlyphLayoutArray<8> glyphs; int nglyphs = 7; engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); - return qRound(glyphs.advances_x[0]); + return qRound(glyphs.advances[0]); } /*! \obsolete @@ -642,7 +642,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const QGlyphLayoutArray<8> glyphs; int nglyphs = 7; engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); - width = qRound(glyphs.advances_x[0]); + width = qRound(glyphs.advances[0]); } return width; } @@ -1434,7 +1434,7 @@ qreal QFontMetricsF::width(QChar ch) const QGlyphLayoutArray<8> glyphs; int nglyphs = 7; engine->stringToCMap(&ch, 1, &glyphs, &nglyphs, 0); - return glyphs.advances_x[0].toReal(); + return glyphs.advances[0].toReal(); } /*! -- cgit v1.2.3