sRGB cleanup in image filters. Ensure we configure paints correctly.
Net effect of the two calls is (basically) the same, but given that we're
propagating from isGammaCorrect on the DC, I figured it makes sense to use
the same-named API.
More importantly, a couple places had slipped through, so those draws would
ignore sRGB-ness of inputs entirely.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2357413004
Review-Url: https://codereview.chromium.org/2357413004
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 9ec6f2c..be48ca1 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -292,6 +292,7 @@
if (!drawContext) {
return nullptr;
}
+ paint.setGammaCorrect(drawContext->isGammaCorrect());
SkIRect dstIRect = SkIRect::MakeWH(bounds.width(), bounds.height());
SkRect srcRect = SkRect::Make(bounds);
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 8fc0ec1..8d06807 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -344,6 +344,7 @@
if (!drawContext) {
return nullptr;
}
+ paint.setGammaCorrect(drawContext->isGammaCorrect());
drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(colorBounds));
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 138ba8b..66d3a17 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -392,7 +392,7 @@
const SkIRect& bounds) const {
SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()));
GrPaint paint;
- paint.setAllowSRGBInputs(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(drawContext->isGammaCorrect());
sk_sp<GrFragmentProcessor> fp(this->makeFragmentProcessor(src, matrix, srcBounds,
boundaryMode));
paint.addColorFragmentProcessor(std::move(fp));
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index b8d4884..82e47c5 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -395,7 +395,7 @@
float bounds[2],
Gr1DKernelEffect::Direction direction) {
GrPaint paint;
- paint.setAllowSRGBInputs(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(drawContext->isGammaCorrect());
paint.addColorFragmentProcessor(GrMorphologyEffect::Make(texture,
direction,
radius,
@@ -415,7 +415,7 @@
GrMorphologyEffect::MorphologyType morphType,
Gr1DKernelEffect::Direction direction) {
GrPaint paint;
- paint.setAllowSRGBInputs(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(drawContext->isGammaCorrect());
paint.addColorFragmentProcessor(GrMorphologyEffect::Make(texture, direction, radius,
morphType));
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 62daa5a..c7e4143 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -250,7 +250,7 @@
if (!drawContext) {
return nullptr;
}
- paint.setAllowSRGBInputs(drawContext->isGammaCorrect());
+ paint.setGammaCorrect(drawContext->isGammaCorrect());
SkMatrix matrix;
matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));