aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkMaskGamma.cpp
diff options
context:
space:
mode:
authorGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-24 17:46:11 +0000
committerGravatar bungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-24 17:46:11 +0000
commitfd668cfffe3fdcfbf6e0b858343a62818d337590 (patch)
tree593fd990decefe58cb80b4f1cf4aa7d397f8d0ec /src/core/SkMaskGamma.cpp
parent0032407e294aecc9306e1610c0cf0d998c9a5cfe (diff)
Fix greenish text rendering on Linux.
Diffstat (limited to 'src/core/SkMaskGamma.cpp')
-rw-r--r--src/core/SkMaskGamma.cpp9
1 files changed, 6 insertions, 3 deletions
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;