diff options
author | brianosman <brianosman@google.com> | 2016-04-12 12:48:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-12 12:48:21 -0700 |
commit | 0586f5cc9713268238394411a5daa2c7758b092b (patch) | |
tree | 74d7c1a3786a306dab0dd3fdfe8e1bcb25f9f57f /src/gpu/effects/GrDistanceFieldGeoProc.h | |
parent | 134ff5c9cf99e1a930cb1b77bf8fb2b7b2c31d31 (diff) |
sRGB support for distance field text.
Add a second distance field adjust table that only applies contrast,
not fake-gamma correction. Store a flag in the batch at creation time,
using the same logic we apply elsewhere (render target format, plus
paint flags).
That gets us close, but not as good as bitmap text. The final step is
to use a linear step function (rather than smoothstep) to map distance
to coverage, when we have sRGB output. Smoothstep's nonlinear response
is actually doing some fake-gamma, so it ends up over-correcting when
the output is already gamma-correct.
Results are now very close between L32 (old table, smoothstep) and S32
(contrast-only table, linstep).
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1885613002
Review URL: https://codereview.chromium.org/1885613002
Diffstat (limited to 'src/gpu/effects/GrDistanceFieldGeoProc.h')
-rw-r--r-- | src/gpu/effects/GrDistanceFieldGeoProc.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.h b/src/gpu/effects/GrDistanceFieldGeoProc.h index 05fffa58d6..2786b7e823 100644 --- a/src/gpu/effects/GrDistanceFieldGeoProc.h +++ b/src/gpu/effects/GrDistanceFieldGeoProc.h @@ -22,6 +22,7 @@ enum GrDistanceFieldEffectFlags { kUseLCD_DistanceFieldEffectFlag = 0x04, // use lcd text kBGR_DistanceFieldEffectFlag = 0x08, // lcd display has bgr order kPortrait_DistanceFieldEffectFlag = 0x10, // lcd display is in portrait mode (not used yet) + kSRGB_DistanceFieldEffectFlag = 0x20, // assume sRGB dest (use linstep, not smoothstep) kInvalid_DistanceFieldEffectFlag = 0x80, // invalid state (for initialization) @@ -29,12 +30,14 @@ enum GrDistanceFieldEffectFlags { kScaleOnly_DistanceFieldEffectFlag, // The subset of the flags relevant to GrDistanceFieldA8TextGeoProc kNonLCD_DistanceFieldEffectMask = kSimilarity_DistanceFieldEffectFlag | - kScaleOnly_DistanceFieldEffectFlag, + kScaleOnly_DistanceFieldEffectFlag | + kSRGB_DistanceFieldEffectFlag, // The subset of the flags relevant to GrDistanceFieldLCDTextGeoProc kLCD_DistanceFieldEffectMask = kSimilarity_DistanceFieldEffectFlag | kScaleOnly_DistanceFieldEffectFlag | kUseLCD_DistanceFieldEffectFlag | - kBGR_DistanceFieldEffectFlag, + kBGR_DistanceFieldEffectFlag | + kSRGB_DistanceFieldEffectFlag, }; /** |