diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-03 22:22:16 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-03 22:22:16 +0000 |
commit | aba651c3f1a1657bbe5367c873500e7c60539a3e (patch) | |
tree | edea14041d9120ae2c1d1d073017150f58e30071 /src/effects | |
parent | 29af1f35d7f9fc7905fd0e78dd2174897492d147 (diff) |
Fix image filter crop offsets for GPU path.
This is the GPU-side version of
https://codereview.chromium.org/112803004/.
Also factored the crop offset unit test into a function, so we can
call it with both CPU & GPU devices.
R=bsalomon@google.com
Review URL: https://codereview.chromium.org/153113003
git-svn-id: http://skia.googlecode.com/svn/trunk@13292 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/SkBlurImageFilter.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp index 196baf4804..ccc7ec3866 100644 --- a/src/effects/SkBlurImageFilter.cpp +++ b/src/effects/SkBlurImageFilter.cpp @@ -240,17 +240,22 @@ bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkBitmap* result, SkIPoint* offset) { #if SK_SUPPORT_GPU SkBitmap input; - if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &input, offset)) { + SkIPoint srcOffset = SkIPoint::Make(0, 0); + if (!SkImageFilterUtils::GetInputResultGPU(getInput(0), proxy, src, ctm, &input, &srcOffset)) { return false; } GrTexture* source = input.getTexture(); SkIRect rect; src.getBounds(&rect); + rect.offset(srcOffset); if (!this->applyCropRect(&rect, ctm)) { return false; } SkVector sigma, localSigma = SkVector::Make(fSigma.width(), fSigma.height()); ctm.mapVectors(&sigma, &localSigma, 1); + offset->fX = rect.fLeft; + offset->fY = rect.fTop; + rect.offset(-srcOffset); SkAutoTUnref<GrTexture> tex(SkGpuBlurUtils::GaussianBlur(source->getContext(), source, false, @@ -258,8 +263,6 @@ bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const true, sigma.x(), sigma.y())); - offset->fX = rect.fLeft; - offset->fY = rect.fTop; return SkImageFilterUtils::WrapTexture(tex, rect.width(), rect.height(), result); #else SkDEBUGFAIL("Should not call in GPU-less build"); |