diff options
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/SkAlphaThresholdFilter.cpp | 3 | ||||
-rw-r--r-- | src/effects/SkBlurMaskFilter.cpp | 13 | ||||
-rw-r--r-- | src/effects/SkDisplacementMapEffect.cpp | 3 | ||||
-rw-r--r-- | src/effects/SkGpuBlurUtils.cpp | 42 | ||||
-rw-r--r-- | src/effects/SkMorphologyImageFilter.cpp | 32 | ||||
-rw-r--r-- | src/effects/SkXfermodeImageFilter.cpp | 2 |
6 files changed, 39 insertions, 56 deletions
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp index 09dc7427e5..f78c9c0b8c 100644 --- a/src/effects/SkAlphaThresholdFilter.cpp +++ b/src/effects/SkAlphaThresholdFilter.cpp @@ -292,8 +292,7 @@ bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp, while (!iter.done()) { SkRect rect = SkRect::Make(iter.rect()); - context->drawRect(maskTexture->asRenderTarget(), GrClip::WideOpen(), grPaint, - in_matrix, rect); + context->drawRect(maskTexture->asRenderTarget(), grPaint, in_matrix, rect); iter.next(); } } diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index d7c874cfda..ae4f756b25 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -50,14 +50,12 @@ public: virtual bool directFilterMaskGPU(GrContext* context, GrRenderTarget* rt, GrPaint* grp, - const GrClip&, const SkMatrix& viewMatrix, const SkStrokeRec& strokeRec, const SkPath& path) const SK_OVERRIDE; virtual bool directFilterRRectMaskGPU(GrContext* context, GrRenderTarget* rt, GrPaint* grp, - const GrClip&, const SkMatrix& viewMatrix, const SkStrokeRec& strokeRec, const SkRRect& rrect) const SK_OVERRIDE; @@ -832,7 +830,6 @@ GrFragmentProcessor* GrRectBlurEffect::TestCreate(SkRandom* random, bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrContext* context, GrRenderTarget* rt, GrPaint* grp, - const GrClip& clip, const SkMatrix& viewMatrix, const SkStrokeRec& strokeRec, const SkPath& path) const { @@ -866,7 +863,7 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrContext* context, if (!viewMatrix.invert(&inverse)) { return false; } - context->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), rect, inverse); + context->drawNonAARectWithLocalMatrix(rt, *grp, SkMatrix::I(), rect, inverse); return true; } @@ -1123,7 +1120,6 @@ GrGLFragmentProcessor* GrRRectBlurEffect::createGLInstance() const { bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context, GrRenderTarget* rt, GrPaint* grp, - const GrClip& clip, const SkMatrix& viewMatrix, const SkStrokeRec& strokeRec, const SkRRect& rrect) const { @@ -1152,7 +1148,7 @@ bool SkBlurMaskFilterImpl::directFilterRRectMaskGPU(GrContext* context, if (!viewMatrix.invert(&inverse)) { return false; } - context->drawNonAARectWithLocalMatrix(rt, clip, *grp, SkMatrix::I(), proxy_rect, inverse); + context->drawNonAARectWithLocalMatrix(rt, *grp, SkMatrix::I(), proxy_rect, inverse); return true; } @@ -1204,6 +1200,8 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src, GrContext* context = src->getContext(); + GrContext::AutoWideOpenIdentityDraw awo(context); + SkScalar xformedSigma = this->computeXformedSigma(ctm); SkASSERT(xformedSigma > 0); @@ -1234,8 +1232,7 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src, // = 0 * src + (1 - src) * dst paint.setCoverageSetOpXPFactory(SkRegion::kDifference_Op); } - context->drawRect((*result)->asRenderTarget(), GrClip::WideOpen(), paint, SkMatrix::I(), - clipRect); + context->drawRect((*result)->asRenderTarget(), paint, SkMatrix::I(), clipRect); } return true; diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 25339e613c..0463fb08b8 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -449,8 +449,7 @@ bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkMatrix matrix; matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colorBounds.y())); - context->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, matrix, - SkRect::Make(colorBounds)); + context->drawRect(dst->asRenderTarget(), paint, matrix, SkRect::Make(colorBounds)); offset->fX = bounds.left(); offset->fY = bounds.top(); WrapTexture(dst, bounds.width(), bounds.height(), result); diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp index 832e48a4e0..77e225888c 100644 --- a/src/effects/SkGpuBlurUtils.cpp +++ b/src/effects/SkGpuBlurUtils.cpp @@ -45,7 +45,6 @@ static float adjust_sigma(float sigma, int maxTextureSize, int *scaleFactor, int static void convolve_gaussian_1d(GrContext* context, GrRenderTarget* rt, - const GrClip& clip, const SkRect& srcRect, const SkRect& dstRect, GrTexture* texture, @@ -58,12 +57,11 @@ static void convolve_gaussian_1d(GrContext* context, SkAutoTUnref<GrFragmentProcessor> conv(GrConvolutionEffect::CreateGaussian( texture, direction, radius, sigma, useBounds, bounds)); paint.addColorProcessor(conv); - context->drawNonAARectToRect(rt, clip, paint, SkMatrix::I(), dstRect, srcRect); + context->drawNonAARectToRect(rt, paint, SkMatrix::I(), dstRect, srcRect); } static void convolve_gaussian_2d(GrContext* context, GrRenderTarget* rt, - const GrClip& clip, const SkRect& srcRect, const SkRect& dstRect, GrTexture* texture, @@ -81,12 +79,11 @@ static void convolve_gaussian_2d(GrContext* context, useBounds ? GrTextureDomain::kClamp_Mode : GrTextureDomain::kIgnore_Mode, true, sigmaX, sigmaY)); paint.addColorProcessor(conv); - context->drawNonAARectToRect(rt, clip, paint, SkMatrix::I(), dstRect, srcRect); + context->drawNonAARectToRect(rt, paint, SkMatrix::I(), dstRect, srcRect); } static void convolve_gaussian(GrContext* context, GrRenderTarget* rt, - const GrClip& clip, const SkRect& srcRect, const SkRect& dstRect, GrTexture* texture, @@ -96,7 +93,7 @@ static void convolve_gaussian(GrContext* context, bool cropToSrcRect) { float bounds[2] = { 0.0f, 1.0f }; if (!cropToSrcRect) { - convolve_gaussian_1d(context, rt, clip, srcRect, dstRect, texture, + convolve_gaussian_1d(context, rt, srcRect, dstRect, texture, direction, radius, sigma, false, bounds); return; } @@ -128,15 +125,15 @@ static void convolve_gaussian(GrContext* context, } if (radius >= size * SK_ScalarHalf) { // Blur radius covers srcRect; use bounds over entire draw - convolve_gaussian_1d(context, rt, clip, srcRect, dstRect, texture, + convolve_gaussian_1d(context, rt, srcRect, dstRect, texture, direction, radius, sigma, true, bounds); } else { // Draw upper and lower margins with bounds; middle without. - convolve_gaussian_1d(context, rt, clip, lowerSrcRect, lowerDstRect, texture, + convolve_gaussian_1d(context, rt, lowerSrcRect, lowerDstRect, texture, direction, radius, sigma, true, bounds); - convolve_gaussian_1d(context, rt, clip, upperSrcRect, upperDstRect, texture, + convolve_gaussian_1d(context, rt, upperSrcRect, upperDstRect, texture, direction, radius, sigma, true, bounds); - convolve_gaussian_1d(context, rt, clip, middleSrcRect, middleDstRect, texture, + convolve_gaussian_1d(context, rt, middleSrcRect, middleDstRect, texture, direction, radius, sigma, false, bounds); } } @@ -163,8 +160,7 @@ GrTexture* GaussianBlur(GrContext* context, scale_rect(&srcRect, static_cast<float>(scaleFactorX), static_cast<float>(scaleFactorY)); - // setup new clip - GrClip clip(SkRect::MakeWH(srcRect.width(), srcRect.height())); + GrContext::AutoClip acs(context, SkRect::MakeWH(srcRect.width(), srcRect.height())); SkASSERT(kBGRA_8888_GrPixelConfig == srcTexture->config() || kRGBA_8888_GrPixelConfig == srcTexture->config() || @@ -217,8 +213,8 @@ GrTexture* GaussianBlur(GrContext* context, } scale_rect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f, i < scaleFactorY ? 0.5f : 1.0f); - context->drawNonAARectToRect(dstTexture->asRenderTarget(), clip, paint, SkMatrix::I(), - dstRect, srcRect); + context->drawNonAARectToRect(dstTexture->asRenderTarget(), paint, SkMatrix::I(), dstRect, + srcRect); srcRect = dstRect; srcTexture = dstTexture; SkTSwap(dstTexture, tempTexture); @@ -233,8 +229,8 @@ GrTexture* GaussianBlur(GrContext* context, // We shouldn't be scaling because this is a small size blur SkASSERT((scaleFactorX == scaleFactorY) == 1); SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); - convolve_gaussian_2d(context, dstTexture->asRenderTarget(), clip, srcRect, dstRect, - srcTexture, radiusX, radiusY, sigmaX, sigmaY, cropToRect, srcIRect); + convolve_gaussian_2d(context, dstTexture->asRenderTarget(), srcRect, dstRect, srcTexture, + radiusX, radiusY, sigmaX, sigmaY, cropToRect, srcIRect); srcTexture = dstTexture; srcRect = dstRect; SkTSwap(dstTexture, tempTexture); @@ -249,9 +245,8 @@ GrTexture* GaussianBlur(GrContext* context, context->clear(&clearRect, 0x0, false, srcTexture->asRenderTarget()); } SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); - convolve_gaussian(context, dstTexture->asRenderTarget(), clip, srcRect, dstRect, - srcTexture, Gr1DKernelEffect::kX_Direction, radiusX, sigmaX, - cropToRect); + convolve_gaussian(context, dstTexture->asRenderTarget(), srcRect, dstRect, srcTexture, + Gr1DKernelEffect::kX_Direction, radiusX, sigmaX, cropToRect); srcTexture = dstTexture; srcRect = dstRect; SkTSwap(dstTexture, tempTexture); @@ -267,9 +262,8 @@ GrTexture* GaussianBlur(GrContext* context, } SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); - convolve_gaussian(context, dstTexture->asRenderTarget(), clip, srcRect, - dstRect, srcTexture, Gr1DKernelEffect::kY_Direction, radiusY, sigmaY, - cropToRect); + convolve_gaussian(context, dstTexture->asRenderTarget(), srcRect, dstRect, srcTexture, + Gr1DKernelEffect::kY_Direction, radiusY, sigmaY, cropToRect); srcTexture = dstTexture; srcRect = dstRect; SkTSwap(dstTexture, tempTexture); @@ -295,8 +289,8 @@ GrTexture* GaussianBlur(GrContext* context, SkRect dstRect(srcRect); scale_rect(&dstRect, (float) scaleFactorX, (float) scaleFactorY); - context->drawNonAARectToRect(dstTexture->asRenderTarget(), clip, paint, - SkMatrix::I(), dstRect, srcRect); + context->drawNonAARectToRect(dstTexture->asRenderTarget(), paint, SkMatrix::I(), dstRect, + srcRect); srcRect = dstRect; srcTexture = dstTexture; SkTSwap(dstTexture, tempTexture); diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index d2ec036ba7..8c46aae757 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -563,7 +563,6 @@ namespace { void apply_morphology_rect(GrContext* context, GrRenderTarget* rt, - const GrClip& clip, GrTexture* texture, const SkIRect& srcRect, const SkIRect& dstRect, @@ -577,13 +576,12 @@ void apply_morphology_rect(GrContext* context, radius, morphType, bounds))->unref(); - context->drawNonAARectToRect(rt, clip, paint, SkMatrix::I(), SkRect::Make(dstRect), + context->drawNonAARectToRect(rt, paint, SkMatrix::I(), SkRect::Make(dstRect), SkRect::Make(srcRect)); } void apply_morphology_rect_no_bounds(GrContext* context, GrRenderTarget* rt, - const GrClip& clip, GrTexture* texture, const SkIRect& srcRect, const SkIRect& dstRect, @@ -595,13 +593,12 @@ void apply_morphology_rect_no_bounds(GrContext* context, direction, radius, morphType))->unref(); - context->drawNonAARectToRect(rt, clip, paint, SkMatrix::I(), SkRect::Make(dstRect), + context->drawNonAARectToRect(rt, paint, SkMatrix::I(), SkRect::Make(dstRect), SkRect::Make(srcRect)); } void apply_morphology_pass(GrContext* context, GrRenderTarget* rt, - const GrClip& clip, GrTexture* texture, const SkIRect& srcRect, const SkIRect& dstRect, @@ -633,16 +630,16 @@ void apply_morphology_pass(GrContext* context, } if (middleSrcRect.fLeft - middleSrcRect.fRight >= 0) { // radius covers srcRect; use bounds over entire draw - apply_morphology_rect(context, rt, clip, texture, srcRect, dstRect, radius, + apply_morphology_rect(context, rt, texture, srcRect, dstRect, radius, morphType, bounds, direction); } else { // Draw upper and lower margins with bounds; middle without. - apply_morphology_rect(context, rt, clip, texture, lowerSrcRect, lowerDstRect, radius, + apply_morphology_rect(context, rt,texture, lowerSrcRect, lowerDstRect, radius, morphType, bounds, direction); - apply_morphology_rect(context, rt, clip, texture, upperSrcRect, upperDstRect, radius, + apply_morphology_rect(context, rt, texture, upperSrcRect, upperDstRect, radius, morphType, bounds, direction); - apply_morphology_rect_no_bounds(context, rt, clip, texture, middleSrcRect, middleDstRect, - radius, morphType, direction); + apply_morphology_rect_no_bounds(context, rt, texture, middleSrcRect, middleDstRect, radius, + morphType, direction); } } @@ -655,9 +652,8 @@ bool apply_morphology(const SkBitmap& input, SkASSERT(srcTexture); GrContext* context = srcTexture->getContext(); - // setup new clip - GrClip clip(SkRect::MakeWH(SkIntToScalar(srcTexture->width()), - SkIntToScalar(srcTexture->height()))); + GrContext::AutoClip acs(context, SkRect::MakeWH(SkIntToScalar(srcTexture->width()), + SkIntToScalar(srcTexture->height()))); SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height()); GrSurfaceDesc desc; @@ -672,9 +668,8 @@ bool apply_morphology(const SkBitmap& input, if (NULL == texture) { return false; } - apply_morphology_pass(context, texture->asRenderTarget(), clip, srcTexture, - srcRect, dstRect, radius.fWidth, morphType, - Gr1DKernelEffect::kX_Direction); + apply_morphology_pass(context, texture->asRenderTarget(), srcTexture, srcRect, dstRect, + radius.fWidth, morphType, Gr1DKernelEffect::kX_Direction); SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom, dstRect.width(), radius.fHeight); GrColor clearColor = GrMorphologyEffect::kErode_MorphologyType == morphType ? @@ -689,9 +684,8 @@ bool apply_morphology(const SkBitmap& input, if (NULL == texture) { return false; } - apply_morphology_pass(context, texture->asRenderTarget(), clip, srcTexture, - srcRect, dstRect, radius.fHeight, morphType, - Gr1DKernelEffect::kY_Direction); + apply_morphology_pass(context, texture->asRenderTarget(), srcTexture, srcRect, dstRect, + radius.fHeight, morphType, Gr1DKernelEffect::kY_Direction); srcTexture.reset(texture); } SkImageFilter::WrapTexture(srcTexture, rect.width(), rect.height(), dst); diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp index 2ba5ec5160..ce6e790250 100644 --- a/src/effects/SkXfermodeImageFilter.cpp +++ b/src/effects/SkXfermodeImageFilter.cpp @@ -172,7 +172,7 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, GrPaint paint; paint.addColorTextureProcessor(foregroundTex, foregroundMatrix); paint.addColorProcessor(xferProcessor)->unref(); - context->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, SkMatrix::I(), srcRect); + context->drawRect(dst->asRenderTarget(), paint, SkMatrix::I(), srcRect); offset->fX = backgroundOffset.fX; offset->fY = backgroundOffset.fY; |