diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-11-21 13:33:55 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-01-24 20:42:32 +0000 |
commit | 21f27c9a4d0f2ab0976c144f631c9171c899014b (patch) | |
tree | 01270b13f790565a30ba1a6931e3b786901d9f42 /src/gui/painting/qpaintengine_raster.cpp | |
parent | d2758b2f1dd88d273ff70864a0dd03a7c4e9dc78 (diff) |
Enable gamma-correction on a face-by-face basis
Changes how we control if gamma-correction is done, and enables it for
the freetype CFF engine when stem-darkening is available.
The new code replaces existing hacks to force gamma-correction off
when using Freetype on X11 and Windows.
Change-Id: Ic703ca6965a3d81b204349e10f406c991b292edd
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/gui/painting/qpaintengine_raster.cpp')
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 647bd5cb2c..68b8d78ac6 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2555,7 +2555,7 @@ QRasterBuffer *QRasterPaintEngine::rasterBuffer() /*! \internal */ -void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx,int ry,int w,int h) +void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx,int ry,int w,int h, bool useGammaCorrection) { Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); @@ -2610,14 +2610,14 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx } else if (depth == 8) { if (s->penData.alphamapBlit) { s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color, - scanline, w, h, bpl, 0); + scanline, w, h, bpl, 0, useGammaCorrection); return; } } else if (depth == 32) { // (A)RGB Alpha mask where the alpha component is not used. if (s->penData.alphaRGBBlit) { s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color, - (const uint *) scanline, w, h, bpl / 4, 0); + (const uint *) scanline, w, h, bpl / 4, 0, useGammaCorrection); return; } } @@ -2646,10 +2646,10 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx } if (depth == 8) s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color, - scanline, w, h, bpl, clip); + scanline, w, h, bpl, clip, useGammaCorrection); else if (depth == 32) s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color, - (const uint *) scanline, w, h, bpl / 4, clip); + (const uint *) scanline, w, h, bpl / 4, clip, useGammaCorrection); return; } } @@ -2807,7 +2807,8 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, alphaPenBlt(alphaMap->constBits(), alphaMap->bytesPerLine(), alphaMap->depth(), qFloor(positions[i].x) + offset.x(), qRound(positions[i].y) + offset.y(), - alphaMap->width(), alphaMap->height()); + alphaMap->width(), alphaMap->height(), + fontEngine->expectsGammaCorrectedBlending()); fontEngine->unlockAlphaMapForGlyph(); } @@ -2868,7 +2869,7 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, drawImage(QPoint(x, y), QImage(glyphBits, c.w, c.h, bpl, image.format())); s->matrix = originalTransform; } else { - alphaPenBlt(glyphBits, bpl, depth, x, y, c.w, c.h); + alphaPenBlt(glyphBits, bpl, depth, x, y, c.w, c.h, fontEngine->expectsGammaCorrectedBlending()); } } } |