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
This commit is contained in:
brianosman 2016-07-26 10:21:54 -07:00 committed by Commit bot
parent a5e1e33d39
commit 9dc935fa11
5 changed files with 6 additions and 17 deletions

View File

@ -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;

View File

@ -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(),

View File

@ -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) {

View File

@ -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());

View File

@ -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,