diff options
author | egdaniel <egdaniel@google.com> | 2015-11-23 13:20:41 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-23 13:20:42 -0800 |
commit | c4b72720e75313079212e69e46a5ef7c474b2305 (patch) | |
tree | b0bf74db86503bd22684bb3107613db4e6625244 /src/effects | |
parent | 60ce86d4718dab83f33488ec41710ad6763fc7f8 (diff) |
Don't create a GXPFactory when blend is SrcOver
BUG=skia:
Review URL: https://codereview.chromium.org/1471053002
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/SkArithmeticMode_gpu.h | 4 | ||||
-rw-r--r-- | src/effects/SkBlurMaskFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkDisplacementMapEffect.cpp | 1 | ||||
-rw-r--r-- | src/effects/SkGpuBlurUtils.cpp | 4 | ||||
-rw-r--r-- | src/effects/SkLightingImageFilter.cpp | 1 | ||||
-rw-r--r-- | src/effects/SkMorphologyImageFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkPerlinNoiseShader.cpp | 1 | ||||
-rw-r--r-- | src/effects/SkXfermodeImageFilter.cpp | 1 |
8 files changed, 11 insertions, 5 deletions
diff --git a/src/effects/SkArithmeticMode_gpu.h b/src/effects/SkArithmeticMode_gpu.h index ee3e73abb0..b24d23a6e6 100644 --- a/src/effects/SkArithmeticMode_gpu.h +++ b/src/effects/SkArithmeticMode_gpu.h @@ -81,10 +81,6 @@ public: return new GrArithmeticXPFactory(k1, k2, k3, k4, enforcePMColor); } - bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const override { - return true; - } - void getInvariantBlendedColor(const GrProcOptInfo& colorPOI, GrXPFactory::InvariantBlendedColor*) const override; diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 0dedf0208c..8dd82c5ac3 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -1262,6 +1262,8 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src, // outer: dst = dst * (1 - src) // = 0 * src + (1 - src) * dst paint.setCoverageSetOpXPFactory(SkRegion::kDifference_Op); + } else { + paint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); } SkAutoTUnref<GrDrawContext> drawContext(context->drawContext((*result)->asRenderTarget())); diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 77d6cb84aa..fe918581c4 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -445,6 +445,7 @@ bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, offsetMatrix, color, colorBM.dimensions()))->unref(); + paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); SkIRect colorBounds = bounds; colorBounds.offset(-colorOffset); SkMatrix matrix; diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp index 2e6a7d6bde..8ab05dd862 100644 --- a/src/effects/SkGpuBlurUtils.cpp +++ b/src/effects/SkGpuBlurUtils.cpp @@ -59,6 +59,7 @@ static void convolve_gaussian_1d(GrDrawContext* drawContext, SkAutoTUnref<GrFragmentProcessor> conv(GrConvolutionEffect::CreateGaussian( texture, direction, radius, sigma, useBounds, bounds)); paint.addColorFragmentProcessor(conv); + paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); SkMatrix localMatrix = SkMatrix::MakeTrans(srcOffset.x(), srcOffset.y()); drawContext->fillRectWithLocalMatrix(clip, paint, SkMatrix::I(), dstRect, localMatrix); } @@ -89,6 +90,7 @@ static void convolve_gaussian_2d(GrDrawContext* drawContext, srcBounds ? GrTextureDomain::kDecal_Mode : GrTextureDomain::kIgnore_Mode, true, sigmaX, sigmaY)); paint.addColorFragmentProcessor(conv); + paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); drawContext->fillRectWithLocalMatrix(clip, paint, SkMatrix::I(), dstRect, localMatrix); } @@ -247,6 +249,7 @@ GrTexture* GaussianBlur(GrContext* context, GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode); paint.addColorTextureProcessor(srcTexture, matrix, params); } + paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); scale_rect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f, i < scaleFactorY ? 0.5f : 1.0f); @@ -374,6 +377,7 @@ GrTexture* GaussianBlur(GrContext* context, // FIXME: this should be mitchell, not bilinear. GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode); paint.addColorTextureProcessor(srcTexture, matrix, params); + paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); SkRect dstRect(srcRect); scale_rect(&dstRect, (float) scaleFactorX, (float) scaleFactorY); diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 4bb755e3ed..9b6a20f0ef 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -354,6 +354,7 @@ void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext, GrPaint paint; GrFragmentProcessor* fp = this->getFragmentProcessor(src, matrix, bounds, boundaryMode); paint.addColorFragmentProcessor(fp)->unref(); + paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); } diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index fbc071fe58..484ed57f37 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -479,6 +479,7 @@ void apply_morphology_rect(GrDrawContext* drawContext, radius, morphType, bounds))->unref(); + paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect), SkRect::Make(srcRect)); } @@ -496,6 +497,7 @@ void apply_morphology_rect_no_bounds(GrDrawContext* drawContext, direction, radius, morphType))->unref(); + paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); drawContext->fillRectToRect(clip, paint, SkMatrix::I(), SkRect::Make(dstRect), SkRect::Make(srcRect)); } diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp index c1a6f701d7..916cf78f0d 100644 --- a/src/effects/SkPerlinNoiseShader.cpp +++ b/src/effects/SkPerlinNoiseShader.cpp @@ -608,7 +608,6 @@ const GrFragmentProcessor* GrPerlinNoiseEffect::TestCreate(GrProcessorTestData* SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, stitchTiles ? &tileSize : nullptr)); - GrPaint grPaint; return shader->asFragmentProcessor(d->fContext, GrTest::TestMatrix(d->fRandom), nullptr, kNone_SkFilterQuality); diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp index 28d9a00c84..38d1e5e6b4 100644 --- a/src/effects/SkXfermodeImageFilter.cpp +++ b/src/effects/SkXfermodeImageFilter.cpp @@ -191,6 +191,7 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, if (xferFP) { paint.addColorFragmentProcessor(xferFP)->unref(); } + paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRenderTarget())); if (!drawContext) { |