Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Unified Diff: src/effects/SkBlurImageFilter.cpp

Issue 112803004: Make SkImageFilter crop rects relative to the primitive origin, instead of relative to their parent (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Updated to ToT Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/SkBitmapSource.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkBlurImageFilter.cpp
diff --git a/src/effects/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp
index 2795f3a872a198e2d7a7dfc55f0b5256474e380f..5efef0ba50169ccf723592eb9884b6162f154281 100644
--- a/src/effects/SkBlurImageFilter.cpp
+++ b/src/effects/SkBlurImageFilter.cpp
@@ -137,7 +137,8 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
const SkBitmap& source, const SkMatrix& ctm,
SkBitmap* dst, SkIPoint* offset) {
SkBitmap src = source;
- if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, offset)) {
+ SkIPoint srcOffset = SkIPoint::Make(0, 0);
+ if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctm, &src, &srcOffset)) {
return false;
}
@@ -152,6 +153,7 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
SkIRect srcBounds, dstBounds;
src.getBounds(&srcBounds);
+ srcBounds.offset(srcOffset);
if (!this->applyCropRect(&srcBounds, ctm)) {
return false;
}
@@ -174,6 +176,8 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
if (kernelSizeX == 0 && kernelSizeY == 0) {
src.copyTo(dst, dst->config());
+ offset->fX = srcBounds.fLeft;
+ offset->fY = srcBounds.fTop;
return true;
}
@@ -183,6 +187,9 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
return false;
}
+ offset->fX = srcBounds.fLeft;
+ offset->fY = srcBounds.fTop;
+ srcBounds.offset(-srcOffset);
const SkPMColor* s = src.getAddr32(srcBounds.left(), srcBounds.top());
SkPMColor* t = temp.getAddr32(0, 0);
SkPMColor* d = dst->getAddr32(0, 0);
@@ -212,8 +219,6 @@ bool SkBlurImageFilter::onFilterImage(Proxy* proxy,
boxBlurX(d, h, t, kernelSizeY, highOffsetY, lowOffsetY, h, w);
boxBlurXY(t, h, d, kernelSizeY3, highOffsetY, highOffsetY, h, w);
}
- offset->fX += srcBounds.fLeft;
- offset->fY += srcBounds.fTop;
return true;
}
@@ -237,8 +242,8 @@ bool SkBlurImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
true,
fSigma.width(),
fSigma.height()));
- offset->fX += rect.fLeft;
- offset->fY += rect.fTop;
+ 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");
« no previous file with comments | « src/effects/SkBitmapSource.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698