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/image/qimage.cpp | |
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/image/qimage.cpp')
-rw-r--r-- | src/gui/image/qimage.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index a19b608216..c107fea919 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -3340,9 +3340,13 @@ void qInitImageConversions() #endif } +extern const uchar *qt_pow_rgb_gamma(); + void qGamma_correct_back_to_linear_cs(QImage *image) { - extern uchar qt_pow_rgb_gamma[256]; + const uchar *gamma = qt_pow_rgb_gamma(); + if (!gamma) + return; // gamma correct the pixels back to linear color space... int h = image->height(); @@ -3352,9 +3356,9 @@ void qGamma_correct_back_to_linear_cs(QImage *image) uint *pixels = (uint *) image->scanLine(y); for (int x=0; x<w; ++x) { uint p = pixels[x]; - uint r = qt_pow_rgb_gamma[qRed(p)]; - uint g = qt_pow_rgb_gamma[qGreen(p)]; - uint b = qt_pow_rgb_gamma[qBlue(p)]; + uint r = gamma[qRed(p)]; + uint g = gamma[qGreen(p)]; + uint b = gamma[qBlue(p)]; pixels[x] = (r << 16) | (g << 8) | b | 0xff000000; } } |