Index: src/core/SkImageFilter.cpp |
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp |
index 9b7e5e488f5789f4323a6f7e1fd4e5ed94ee4a47..384f2dce6be9d26cb15db21347c5ec09fa164d94 100644 |
--- a/src/core/SkImageFilter.cpp |
+++ b/src/core/SkImageFilter.cpp |
@@ -106,7 +106,7 @@ bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src, |
} |
bool SkImageFilter::filterBounds(const SkIRect& src, const SkMatrix& ctm, |
- SkIRect* dst) { |
+ SkIRect* dst) const { |
SkASSERT(&src); |
SkASSERT(dst); |
return this->onFilterBounds(src, ctm, dst); |
@@ -210,8 +210,28 @@ bool SkImageFilter::applyCropRect(SkIRect* rect, const SkMatrix& matrix) const { |
} |
bool SkImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, |
- SkIRect* dst) { |
- *dst = src; |
+ SkIRect* dst) const { |
+ if (fInputCount < 1) { |
+ return false; |
+ } |
+ |
+ SkIRect bounds; |
+ for (int i = 0; i < fInputCount; ++i) { |
+ SkImageFilter* filter = this->getInput(i); |
+ SkIRect rect = src; |
+ if (filter && !filter->filterBounds(src, ctm, &rect)) { |
+ return false; |
+ } |
+ if (0 == i) { |
+ bounds = rect; |
+ } else { |
+ bounds.join(rect); |
+ } |
+ } |
+ |
+ // don't modify dst until now, so we don't accidentally change it in the |
+ // loop, but then return false on the next filter. |
+ *dst = bounds; |
return true; |
} |