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

Unified Diff: src/effects/SkMorphologyImageFilter.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/SkMergeImageFilter.cpp ('k') | src/effects/SkOffsetImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkMorphologyImageFilter.cpp
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 7321eb25e21efa3ec13066b5058845170521c888..46302ad520afb1397d946061104a62a8358474cc 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -249,6 +249,20 @@ void SkMorphologyImageFilter::computeFastBounds(const SkRect& src, SkRect* dst)
dst->outset(SkIntToScalar(fRadius.width()), SkIntToScalar(fRadius.height()));
}
+bool SkMorphologyImageFilter::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 radius = SkVector::Make(SkIntToScalar(this->radius().width()),
+ SkIntToScalar(this->radius().height()));
+ ctm.mapVectors(&radius, 1);
+ bounds.outset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radius.y()));
+ *dst = bounds;
+ return true;
+}
+
#if SK_SUPPORT_GPU
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/effects/SkMergeImageFilter.cpp ('k') | src/effects/SkOffsetImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698