summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsfontengine.cpp
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-01-30 05:46:35 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-30 12:43:33 +0100
commita5614264d5a5d6d1cc0f2773f4d7cd70195a0546 (patch)
tree23ce986e78fd6d84e57972be6502fa9ac7f2d7dc /src/plugins/platforms/windows/qwindowsfontengine.cpp
parentdca65cd2bc1a999b81df9d45c317a92651db3f82 (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/plugins/platforms/windows/qwindowsfontengine.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsfontengine.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp
index 6ff000e7d4..35346e5b45 100644
--- a/src/plugins/platforms/windows/qwindowsfontengine.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp
@@ -431,8 +431,7 @@ void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::Shape
calculateTTFGlyphWidth(hdc, glyph, width);
designAdvances[glyph] = QFixed(width) / designToDevice;
}
- glyphs->advances_x[i] = designAdvances[glyph];
- glyphs->advances_y[i] = 0;
+ glyphs->advances[i] = designAdvances[glyph];
}
if(oldFont)
DeleteObject(SelectObject(hdc, oldFont));
@@ -440,8 +439,6 @@ void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::Shape
for(int i = 0; i < glyphs->numGlyphs; i++) {
unsigned int glyph = glyphs->glyphs[i];
- glyphs->advances_y[i] = 0;
-
if (glyph >= widthCacheSize) {
int newSize = (glyph + 256) >> 8 << 8;
widthCache = q_check_ptr((unsigned char *)realloc(widthCache,
@@ -449,9 +446,9 @@ void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::Shape
memset(widthCache + widthCacheSize, 0, newSize - widthCacheSize);
widthCacheSize = newSize;
}
- glyphs->advances_x[i] = widthCache[glyph];
+ glyphs->advances[i] = widthCache[glyph];
// font-width cache failed
- if (glyphs->advances_x[i] == 0) {
+ if (glyphs->advances[i].value() == 0) {
int width = 0;
if (!oldFont)
oldFont = SelectObject(hdc, hfont);
@@ -470,7 +467,7 @@ void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::Shape
} else {
calculateTTFGlyphWidth(hdc, glyph, width);
}
- glyphs->advances_x[i] = width;
+ glyphs->advances[i] = width;
// if glyph's within cache range, store it for later
if (width > 0 && width < 0x100)
widthCache[glyph] = width;