Chromium Code Reviews| Index: src/effects/SkGpuBlurUtils.cpp |
| diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp |
| index c43f27303e643df9d7b294f3b2829c1e098e4079..d137180bd4bec931410a0182010e268b79377f8e 100644 |
| --- a/src/effects/SkGpuBlurUtils.cpp |
| +++ b/src/effects/SkGpuBlurUtils.cpp |
| @@ -56,6 +56,7 @@ static void convolve_gaussian_1d(GrDrawContext* drawContext, |
| bool useBounds, |
| float bounds[2]) { |
| GrPaint paint; |
| + paint.setAllowSRGBInputs(drawContext->allowSRGBInputs()); |
| SkAutoTUnref<GrFragmentProcessor> conv(GrConvolutionEffect::CreateGaussian( |
| texture, direction, radius, sigma, useBounds, bounds)); |
| paint.addColorFragmentProcessor(conv); |
| @@ -78,6 +79,7 @@ static void convolve_gaussian_2d(GrDrawContext* drawContext, |
| SkISize size = SkISize::Make(2 * radiusX + 1, 2 * radiusY + 1); |
| SkIPoint kernelOffset = SkIPoint::Make(radiusX, radiusY); |
| GrPaint paint; |
| + paint.setAllowSRGBInputs(drawContext->allowSRGBInputs()); |
| SkIRect bounds; |
| if (srcBounds) { |
| srcBounds->roundOut(&bounds); |
| @@ -164,6 +166,7 @@ static void convolve_gaussian(GrDrawContext* drawContext, |
| GrTexture* GaussianBlur(GrContext* context, |
| GrTexture* srcTexture, |
| bool canClobberSrc, |
| + bool allowSRGBInputs, |
| const SkRect& dstBounds, |
| const SkRect* srcBounds, |
| float sigmaX, |
| @@ -229,6 +232,7 @@ GrTexture* GaussianBlur(GrContext* context, |
| for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) { |
| GrPaint paint; |
| + paint.setAllowSRGBInputs(allowSRGBInputs); |
| SkMatrix matrix; |
| matrix.setIDiv(srcTexture->width(), srcTexture->height()); |
| SkRect dstRect(srcRect); |
| @@ -268,6 +272,9 @@ GrTexture* GaussianBlur(GrContext* context, |
| localSrcBounds = srcRect; |
| } |
| + SkSurfaceProps props(allowSRGBInputs ? SkSurfaceProps::kAllowSRGBInputs_Flag : 0, |
| + SkSurfaceProps::kLegacyFontHost_InitType); |
| + |
| // For really small blurs (certainly no wider than 5x5 on desktop gpus) it is faster to just |
| // launch a single non separable kernel vs two launches |
| srcRect = localDstBounds; |
| @@ -277,7 +284,8 @@ GrTexture* GaussianBlur(GrContext* context, |
| SkASSERT((1 == scaleFactorX) && (1 == scaleFactorY)); |
| SkAutoTUnref<GrDrawContext> dstDrawContext( |
|
robertphillips
2016/04/05 12:54:34
I would probably move this move left and put it on
Brian Osman
2016/04/05 15:36:41
Acknowledged.
|
| - context->drawContext(dstTexture->asRenderTarget())); |
| + context->drawContext(dstTexture->asRenderTarget(), |
| + &props)); |
| if (!dstDrawContext) { |
| return nullptr; |
| } |
| @@ -311,7 +319,8 @@ GrTexture* GaussianBlur(GrContext* context, |
| } |
| SkAutoTUnref<GrDrawContext> dstDrawContext( |
|
robertphillips
2016/04/05 12:54:34
here too
Brian Osman
2016/04/05 15:36:41
Acknowledged.
|
| - context->drawContext(dstTexture->asRenderTarget())); |
| + context->drawContext(dstTexture->asRenderTarget(), |
| + &props)); |
| if (!dstDrawContext) { |
| return nullptr; |
| } |
| @@ -344,7 +353,8 @@ GrTexture* GaussianBlur(GrContext* context, |
| } |
| SkAutoTUnref<GrDrawContext> dstDrawContext( |
|
robertphillips
2016/04/05 12:54:34
3
Brian Osman
2016/04/05 15:36:41
Acknowledged.
|
| - context->drawContext(dstTexture->asRenderTarget())); |
| + context->drawContext(dstTexture->asRenderTarget(), |
| + &props)); |
| if (!dstDrawContext) { |
| return nullptr; |
| } |
| @@ -375,6 +385,7 @@ GrTexture* GaussianBlur(GrContext* context, |
| matrix.setIDiv(srcTexture->width(), srcTexture->height()); |
| GrPaint paint; |
| + paint.setAllowSRGBInputs(allowSRGBInputs); |
| // FIXME: this should be mitchell, not bilinear. |
| GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode); |
| paint.addColorTextureProcessor(srcTexture, matrix, params); |