diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-11-02 17:02:11 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-04 14:31:25 +0100 |
commit | 171e137d25dccca15b31e6bd01de58776f3d9e94 (patch) | |
tree | f94b10cbaa65b18c32b199b315e0b27763bec534 /src/gui/text | |
parent | 780a03191feb2b5f64de97ad623ad9e0c4f5871a (diff) |
Improve QtGui start-up time and memory use.
The gamma lookup tables can be allocated and computed on demand, as
they're not always needed, depending on the platform and the use case.
Change-Id: I2d4c2860746366a0e46edb53bd4ecd2778de2464
Reviewed-by: Olivier Goffart <ogoffart@kde.org>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qfontenginedirectwrite.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp index 5bac1172fa..952e06d151 100644 --- a/src/gui/text/qfontenginedirectwrite.cpp +++ b/src/gui/text/qfontenginedirectwrite.cpp @@ -508,7 +508,7 @@ qreal QFontEngineDirectWrite::maxCharWidth() const return 0; } -extern uint qt_pow_gamma[256]; +extern const uint *qt_pow_gamma(); QImage QFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &xform) @@ -521,11 +521,13 @@ QImage QFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPo colors[i] = qRgba(0, 0, 0, i); indexed.setColorTable(colors); + uint *gamma = qt_pow_gamma(); for (int y=0; y<im.height(); ++y) { uint *src = (uint*) im.scanLine(y); uchar *dst = indexed.scanLine(y); for (int x=0; x<im.width(); ++x) { - *dst = 255 - (qt_pow_gamma[qGray(0xffffffff - *src)] * 255. / 2047.); + uint gray = qGray(0xffffffff - *src); + *dst = 255 - (gamma ? gamma[gray] * 255. / 2047. : gray); ++dst; ++src; } |