aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-07-26 10:21:54 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-26 10:21:55 -0700
commit9dc935fa11521d4a6c7875699c050044a45d0871 (patch)
tree53ff5ac83820ebe50368f59610e2eaf751f113d3
parenta5e1e33d3916cf766f876d3def88afb373440a04 (diff)
Remove all usage of SkSurfaceProps::isGammaCorrect()
DrawContext's isGammaCorrect now just based on presence of color space. Next change will remove the function and flag entirely, but I wanted to land this separately. This alters a few GMs in srgb/f16 mode, generally those that are creating off-screen surfaces in ways that were somewhat lossy before. No unexplained changes. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2186633002 Review-Url: https://codereview.chromium.org/2186633002
-rw-r--r--include/gpu/GrDrawContext.h2
-rw-r--r--src/effects/SkBlurImageFilter.cpp1
-rw-r--r--src/effects/SkBlurMaskFilter.cpp4
-rw-r--r--src/effects/SkGpuBlurUtils.cpp14
-rw-r--r--src/effects/SkGpuBlurUtils.h2
5 files changed, 6 insertions, 17 deletions
diff --git a/include/gpu/GrDrawContext.h b/include/gpu/GrDrawContext.h
index 01f4ac963b..d5bde08288 100644
--- a/include/gpu/GrDrawContext.h
+++ b/include/gpu/GrDrawContext.h
@@ -274,7 +274,7 @@ public:
int height() const { return fRenderTarget->height(); }
GrPixelConfig config() const { return fRenderTarget->config(); }
int numColorSamples() const { return fRenderTarget->numColorSamples(); }
- bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); }
+ bool isGammaCorrect() const { return SkToBool(fColorSpace.get()); }
SkSourceGammaTreatment sourceGammaTreatment() const {
return this->isGammaCorrect() ? SkSourceGammaTreatment::kRespect
: SkSourceGammaTreatment::kIgnore;
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp
index 23fb2cb53d..37584ab3ad 100644
--- a/src/effects/SkBlurImageFilter.cpp
+++ b/src/effects/SkBlurImageFilter.cpp
@@ -124,7 +124,6 @@ sk_sp<SkSpecialImage> SkBlurImageFilter::onFilterImage(SkSpecialImage* source,
context,
inputTexture.get(),
sk_ref_sp(source->getColorSpace()),
- source->props().isGammaCorrect(),
dstBounds,
&inputBounds,
sigma.x(),
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 76f446c2c2..9e0315f2b7 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -1245,10 +1245,8 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
// If we're doing a normal blur, we can clobber the pathTexture in the
// gaussianBlur. Otherwise, we need to save it for later compositing.
- static const bool kIsGammaCorrect = false;
bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
- sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(context, src,
- nullptr, kIsGammaCorrect,
+ sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(context, src, nullptr,
clipRect, nullptr,
xformedSigma, xformedSigma));
if (!drawContext) {
diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp
index 02629f7087..aad1c3f24a 100644
--- a/src/effects/SkGpuBlurUtils.cpp
+++ b/src/effects/SkGpuBlurUtils.cpp
@@ -183,7 +183,6 @@ namespace SkGpuBlurUtils {
sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
GrTexture* origSrc,
sk_sp<SkColorSpace> colorSpace,
- bool gammaCorrect,
const SkIRect& dstBounds,
const SkIRect* srcBounds,
float sigmaX,
@@ -227,13 +226,9 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
const int height = dstBounds.height();
const GrPixelConfig config = srcTexture->config();
- const SkSurfaceProps props(gammaCorrect ? SkSurfaceProps::kGammaCorrect_Flag : 0,
- SkSurfaceProps::kLegacyFontHost_InitType);
-
sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(SkBackingFit::kApprox,
width, height, config, colorSpace,
- 0, kDefault_GrSurfaceOrigin,
- &props));
+ 0, kDefault_GrSurfaceOrigin));
if (!dstDrawContext) {
return nullptr;
}
@@ -253,8 +248,7 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
sk_sp<GrDrawContext> tmpDrawContext(context->newDrawContext(SkBackingFit::kApprox,
width, height, config, colorSpace,
- 0, kDefault_GrSurfaceOrigin,
- &props));
+ 0, kDefault_GrSurfaceOrigin));
if (!tmpDrawContext) {
return nullptr;
}
@@ -265,7 +259,7 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
GrPaint paint;
- paint.setGammaCorrect(gammaCorrect);
+ paint.setGammaCorrect(dstDrawContext->isGammaCorrect());
SkMatrix matrix;
matrix.setIDiv(srcTexture->width(), srcTexture->height());
SkIRect dstRect(srcRect);
@@ -359,7 +353,7 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
matrix.setIDiv(srcDrawContext->width(), srcDrawContext->height());
GrPaint paint;
- paint.setGammaCorrect(gammaCorrect);
+ paint.setGammaCorrect(dstDrawContext->isGammaCorrect());
// FIXME: this should be mitchell, not bilinear.
GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
sk_sp<GrTexture> tex(srcDrawContext->asTexture());
diff --git a/src/effects/SkGpuBlurUtils.h b/src/effects/SkGpuBlurUtils.h
index 550f3b8d6f..a5de6a242a 100644
--- a/src/effects/SkGpuBlurUtils.h
+++ b/src/effects/SkGpuBlurUtils.h
@@ -24,7 +24,6 @@ namespace SkGpuBlurUtils {
* @param context The GPU context
* @param srcTexture The source texture to be blurred.
* @param colorSpace Color space of the source (used for the drawContext result, too).
- * @param gammaCorrect Should blur be gamma-correct (sRGB to linear, etc...)
* @param dstBounds The destination bounds, relative to the source texture.
* @param srcBounds The source bounds, relative to the source texture. If non-null,
* no pixels will be sampled outside of this rectangle.
@@ -35,7 +34,6 @@ namespace SkGpuBlurUtils {
sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
GrTexture* srcTexture,
sk_sp<SkColorSpace> colorSpace,
- bool gammaCorrect,
const SkIRect& dstBounds,
const SkIRect* srcBounds,
float sigmaX,