Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Unified Diff: src/effects/SkGpuBlurUtils.cpp

Issue 1845283003: Gamma-correctness pushed into Skia, top-down. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/effects/SkGpuBlurUtils.cpp
diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp
index c43f27303e643df9d7b294f3b2829c1e098e4079..90619f9dc80899ddd3d62719481ff53c75de963d 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,7 @@ GrTexture* GaussianBlur(GrContext* context,
SkASSERT((1 == scaleFactorX) && (1 == scaleFactorY));
SkAutoTUnref<GrDrawContext> dstDrawContext(
- context->drawContext(dstTexture->asRenderTarget()));
+ context->drawContext(dstTexture->asRenderTarget(), &props));
if (!dstDrawContext) {
return nullptr;
}
@@ -311,7 +318,7 @@ GrTexture* GaussianBlur(GrContext* context,
}
SkAutoTUnref<GrDrawContext> dstDrawContext(
- context->drawContext(dstTexture->asRenderTarget()));
+ context->drawContext(dstTexture->asRenderTarget(), &props));
if (!dstDrawContext) {
return nullptr;
}
@@ -344,7 +351,7 @@ GrTexture* GaussianBlur(GrContext* context,
}
SkAutoTUnref<GrDrawContext> dstDrawContext(
- context->drawContext(dstTexture->asRenderTarget()));
+ context->drawContext(dstTexture->asRenderTarget(), &props));
if (!dstDrawContext) {
return nullptr;
}
@@ -375,6 +382,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);

Powered by Google App Engine
This is Rietveld 408576698