diff options
author | 2014-03-14 15:44:01 +0000 | |
---|---|---|
committer | 2014-03-14 15:44:01 +0000 | |
commit | 4cb543d6057b692e1099e9f115155f0bf323a0c8 (patch) | |
tree | 66f8cbe4e7ef74221766ade874096f934c8b2031 /src/effects/SkBlurImageFilter.cpp | |
parent | 0d30c51c6cf45b3a08a3000b6d348c16bdec7f05 (diff) |
Implement support for a Context parameter in image filters
Some upcoming work (support for expanding crop rects) requires
the clip bounds to be available during filter traversal. This change
replaces the SkMatrix parameter in the onFilterImage() traversals
with a Context parameter. It contains the CTM, as well as the clip
bounds.
BUG=skia:
R=reed@google.com
Review URL: https://codereview.chromium.org/189913021
git-svn-id: http://skia.googlecode.com/svn/trunk@13803 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects/SkBlurImageFilter.cpp')
-rw-r--r-- | src/effects/SkBlurImageFilter.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp index c5e3a78fbb..adcb28f90d 100644 --- a/src/effects/SkBlurImageFilter.cpp +++ b/src/effects/SkBlurImageFilter.cpp @@ -134,11 +134,11 @@ static void getBox3Params(SkScalar s, int *kernelSize, int* kernelSize3, int *lo } bool SkBlurImageFilter::onFilterImage(Proxy* proxy, - const SkBitmap& source, const SkMatrix& ctm, + const SkBitmap& source, const Context& ctx, SkBitmap* dst, SkIPoint* offset) const { SkBitmap src = source; SkIPoint srcOffset = SkIPoint::Make(0, 0); - if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, &srcOffset)) { + if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcOffset)) { return false; } @@ -154,7 +154,7 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy, SkIRect srcBounds, dstBounds; src.getBounds(&srcBounds); srcBounds.offset(srcOffset); - if (!this->applyCropRect(&srcBounds, ctm)) { + if (!this->applyCropRect(&srcBounds, ctx.ctm())) { return false; } @@ -165,7 +165,7 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy, } SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height()); - ctm.mapVectors(&sigma, &localSigma, 1); + ctx.ctm().mapVectors(&sigma, &localSigma, 1); int kernelSizeX, kernelSizeX3, lowOffsetX, highOffsetX; int kernelSizeY, kernelSizeY3, lowOffsetY, highOffsetY; @@ -250,23 +250,23 @@ bool SkBlurImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, return true; } -bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm, +bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, SkBitmap* result, SkIPoint* offset) const { #if SK_SUPPORT_GPU SkBitmap input = src; SkIPoint srcOffset = SkIPoint::Make(0, 0); - if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctm, &input, &srcOffset)) { + if (getInput(0) && !getInput(0)->getInputResultGPU(proxy, src, ctx, &input, &srcOffset)) { return false; } GrTexture* source = input.getTexture(); SkIRect rect; src.getBounds(&rect); rect.offset(srcOffset); - if (!this->applyCropRect(&rect, ctm)) { + if (!this->applyCropRect(&rect, ctx.ctm())) { return false; } SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height()); - ctm.mapVectors(&sigma, &localSigma, 1); + ctx.ctm().mapVectors(&sigma, &localSigma, 1); offset->fX = rect.fLeft; offset->fY = rect.fTop; rect.offset(-srcOffset); |