diff options
author | Brian Osman <brianosman@google.com> | 2016-10-17 16:54:49 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-10-18 12:44:04 +0000 |
commit | 8bf4e672f2c40ef313274f8b79c2c9304f9fff3f (patch) | |
tree | a58cc12b009388922b2e998f5665f474d5d8c4ec /src | |
parent | 8a91da945929b08bfa916595cd1b70fd4341e007 (diff) |
Use legacy color filter API when doing legacy paint conversion
Matt fixed mode color filter so that the 4f filter uses a linearized
version of the stored color. This restores previous behavior, where legacy
devices are doing everything in sRGB space.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3581
Change-Id: I6abac176aaeab1242ca74b71ffb7f6df80ad9525
Reviewed-on: https://skia-review.googlesource.com/3581
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/SkGr.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 8f28d70ac4..0eb9ee496e 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -665,8 +665,15 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context, SkColorFilter* colorFilter = skPaint.getColorFilter(); if (colorFilter) { if (applyColorFilterToPaintColor) { - grPaint->setColor4f(GrColor4f::FromSkColor4f( - colorFilter->filterColor4f(origColor.toSkColor4f())).premul()); + // If we're in legacy mode, we *must* avoid using the 4f version of the color filter, + // because that will combine with the linearized version of the stored color. + if (dc->isGammaCorrect()) { + grPaint->setColor4f(GrColor4f::FromSkColor4f( + colorFilter->filterColor4f(origColor.toSkColor4f())).premul()); + } else { + grPaint->setColor4f(SkColorToPremulGrColor4f( + colorFilter->filterColor(skPaint.getColor()), false, nullptr)); + } } else { sk_sp<GrFragmentProcessor> cfFP(colorFilter->asFragmentProcessor(context)); if (cfFP) { |