CoreText: Store glyphs in linear RGB when needed by blending algorithm

Instead of tying the linear-conversion to a specific function, we move it
to imageForGlyph and base it on the premise for needing it.

Change-Id: Ib8fc79ad419ef703abcb82785ac15d4c75fb98e6
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Tor Arne Vestbø 2018-11-28 12:12:07 +01:00
parent ec254d2555
commit 0cf5648ce6

View File

@ -824,6 +824,9 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
CTFontDrawGlyphs(ctfont, &cgGlyph, &CGPointZero, 1, ctx);
}
if (expectsGammaCorrectedBlending())
qGamma_correct_back_to_linear_cs(&im);
#if defined(Q_OS_MACOS)
if (blackOnWhiteGlyphs)
im.invertPixels();
@ -864,9 +867,7 @@ QImage QCoreTextFontEngine::alphaRGBMapForGlyph(glyph_t glyph, QFixed subPixelPo
if (x.type() > QTransform::TxScale)
return QFontEngine::alphaRGBMapForGlyph(glyph, subPixelPosition, x);
QImage im = imageForGlyph(glyph, subPixelPosition, x);
qGamma_correct_back_to_linear_cs(&im);
return im;
return imageForGlyph(glyph, subPixelPosition, x);
}
QImage QCoreTextFontEngine::bitmapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)