aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar senorblanco <senorblanco@chromium.org>2016-01-26 08:41:02 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-26 08:41:03 -0800
commiteae84c2e0e2126374cd488a1c8a3e18169145635 (patch)
tree768f4953e9c7f31a10bfcbb61e6d98309800c4d0 /src
parent978d08a4a90d69961bd53811ed3ab222b88e2d30 (diff)
Image filters: fix srcOffset handling in asFragmentProcessor() path.
Filters such as SkMatrixConvolutionImageFilter which use the asFragmentProcessor() path were not correctly handling srcOffset. It is correctly applied to the bounds, but the srcRect and dstRect were computed from the pre-offset bounds. The fix is to move them to just above where they're used in drawing. Note: this change adds a new test case to the imagefiltersgraph GM, so it will have to be rebaselined post-landing. BUG=skia:4855 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1637443003 Review URL: https://codereview.chromium.org/1637443003
Diffstat (limited to 'src')
-rw-r--r--src/core/SkImageFilter.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 141d2e03fb..821edc0e1a 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -334,8 +334,6 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont
if (!this->applyCropRect(ctx, proxy, input, &srcOffset, &bounds, &input)) {
return false;
}
- SkRect srcRect = SkRect::Make(bounds);
- SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height());
GrContext* context = srcTexture->getContext();
GrSurfaceDesc desc;
@@ -349,9 +347,6 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont
return false;
}
- // setup new clip
- GrClip clip(dstRect);
-
GrFragmentProcessor* fp;
offset->fX = bounds.left();
offset->fY = bounds.top();
@@ -366,6 +361,9 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont
SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRenderTarget()));
if (drawContext) {
+ SkRect srcRect = SkRect::Make(bounds);
+ SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height());
+ GrClip clip(dstRect);
drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result);