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

Unified Diff: src/effects/SkDropShadowImageFilter.cpp

Issue 23011012: Implement correct clipping for image filters. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add morphology to the list of ignored tests Created 6 years, 10 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/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMergeImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkDropShadowImageFilter.cpp
diff --git a/src/effects/SkDropShadowImageFilter.cpp b/src/effects/SkDropShadowImageFilter.cpp
index 0bc7e1211f26d0e2523e80f49a39943e93de1f27..7cb515265c2151509cfd18d630ca7f8873780be8 100644
--- a/src/effects/SkDropShadowImageFilter.cpp
+++ b/src/effects/SkDropShadowImageFilter.cpp
@@ -112,3 +112,22 @@ void SkDropShadowImageFilter::computeFastBounds(const SkRect& src, SkRect* dst)
SkScalarMul(fSigmaY, SkIntToScalar(3)));
dst->join(shadowBounds);
}
+
+bool SkDropShadowImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
+ SkIRect* dst) const {
+ SkIRect bounds = src;
+ if (getInput(0) && !getInput(0)->filterBounds(src, ctm, &bounds)) {
+ return false;
+ }
+ SkVector offsetVec, localOffsetVec = SkVector::Make(fDx, fDy);
+ ctm.mapVectors(&offsetVec, &localOffsetVec, 1);
+ bounds.offset(-SkScalarCeilToInt(offsetVec.x()),
+ -SkScalarCeilToInt(offsetVec.y()));
+ SkVector sigma, localSigma = SkVector::Make(fSigmaX, fSigmaY);
+ ctm.mapVectors(&sigma, &localSigma, 1);
+ bounds.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))),
+ SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3))));
+ bounds.join(src);
+ *dst = bounds;
+ return true;
+}
« no previous file with comments | « src/effects/SkDisplacementMapEffect.cpp ('k') | src/effects/SkMergeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698