diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2015-03-07 06:01:13 +0400 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2015-04-07 13:09:00 +0000 |
commit | 550fb85b65549d1fc62aba214971578112431c92 (patch) | |
tree | db34317b9d05b7aa23678941918457c72a2b1f13 /src/gui | |
parent | 037ad03182ce3c174a5a9afc6780212bb2fe8a12 (diff) |
[QFontEngineFT] Move code around to improve readability (no-op)
Move some variables initialization closer to the usage context.
Change-Id: I0f1de0ddc9f0fbe3ec4a56455ccc14f9e8d94e5a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 7949bbc2a4..be98e8005f 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -808,13 +808,9 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, { // Q_ASSERT(freetype->lock == 1); - if (format == Format_None) { - if (defaultFormat != Format_None) { - format = defaultFormat; - } else { - format = Format_Mono; - } - } + if (format == Format_None) + format = defaultFormat != Format_None ? defaultFormat : Format_Mono; + Q_ASSERT(format != Format_None); Glyph *g = set ? set->getGlyph(glyph, subPixelPosition) : 0; if (g && g->format == format && (fetchMetricsOnly || g->data)) @@ -823,32 +819,28 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, if (!g && set && set->isGlyphMissing(glyph)) return &emptyGlyph; - QFontEngineFT::GlyphInfo info; - Q_ASSERT(format != Format_None); + FT_Face face = freetype->face; + + FT_Matrix matrix = freetype->matrix; + + FT_Vector v; + v.x = format == Format_Mono ? 0 : FT_Pos(subPixelPosition.value()); + v.y = 0; + FT_Set_Transform(face, &matrix, &v); + bool hsubpixel = false; int vfactor = 1; int load_flags = loadFlags(set, format, 0, hsubpixel, vfactor); - if (format != Format_Mono && !embeddedbitmap) - load_flags |= FT_LOAD_NO_BITMAP; - - FT_Matrix matrix = freetype->matrix; bool transform = matrix.xx != 0x10000 || matrix.yy != 0x10000 || matrix.xy != 0 || matrix.yx != 0; - if (transform) + if (transform || (format != Format_Mono && !embeddedbitmap)) load_flags |= FT_LOAD_NO_BITMAP; - FT_Face face = freetype->face; - - FT_Vector v; - v.x = format == Format_Mono ? 0 : FT_Pos(subPixelPosition.toReal() * 64); - v.y = 0; - FT_Set_Transform(face, &freetype->matrix, &v); - FT_Error err = FT_Load_Glyph(face, glyph, load_flags); if (err && (load_flags & FT_LOAD_NO_BITMAP)) { load_flags &= ~FT_LOAD_NO_BITMAP; @@ -892,6 +884,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, FT_Matrix_Multiply(&m, &matrix); } + GlyphInfo info; info.xOff = TRUNC(ROUND(slot->advance.x)); info.yOff = 0; |