From fd668cfffe3fdcfbf6e0b858343a62818d337590 Mon Sep 17 00:00:00 2001 From: "bungeman@google.com" Date: Fri, 24 Aug 2012 17:46:11 +0000 Subject: Fix greenish text rendering on Linux. https://codereview.appspot.com/6484048/ git-svn-id: http://skia.googlecode.com/svn/trunk@5280 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkMaskGamma.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/core/SkMaskGamma.cpp') diff --git a/src/core/SkMaskGamma.cpp b/src/core/SkMaskGamma.cpp index 47903fbdbb..449a78de93 100644 --- a/src/core/SkMaskGamma.cpp +++ b/src/core/SkMaskGamma.cpp @@ -53,9 +53,12 @@ void SkTMaskGamma_build_correcting_lut(uint8_t table[256], U8CPU srcI, SkScalar const SkColorSpaceLuminance& dstConvert) { const float src = (float)srcI / 255.0f; const float linSrc = srcConvert.toLuma(src); - //Guess at the dst. - const float linDst = 1.0f - linSrc; - const float dst = dstConvert.fromLuma(linDst); + //Guess at the dst. The perceptual inverse provides smaller visual + //discontinuities when slight changes to desaturated colors cause a channel + //to map to a different correcting lut with neighboring srcI. + //See https://code.google.com/p/chromium/issues/detail?id=141425#c59 . + const float dst = 1.0f - src; + const float linDst = dstConvert.toLuma(dst); //Contrast value tapers off to 0 as the src luminance becomes white const float adjustedContrast = SkScalarToFloat(contrast) * linDst; -- cgit v1.2.3