Index: src/effects/SkComposeImageFilter.cpp |
diff --git a/src/effects/SkComposeImageFilter.cpp b/src/effects/SkComposeImageFilter.cpp |
index 4a17e152de704d7b0369ea9ba3f2c731632ea0ec..2b1606a8a40b0a12570af65416754eb698a0cb5c 100644 |
--- a/src/effects/SkComposeImageFilter.cpp |
+++ b/src/effects/SkComposeImageFilter.cpp |
@@ -13,6 +13,15 @@ |
SkComposeImageFilter::~SkComposeImageFilter() { |
} |
+void SkComposeImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const { |
+ SkImageFilter* outer = getInput(0); |
+ SkImageFilter* inner = getInput(1); |
+ |
+ SkRect tmp; |
+ inner->computeFastBounds(src, &tmp); |
+ outer->computeFastBounds(tmp, dst); |
+} |
+ |
bool SkComposeImageFilter::onFilterImage(Proxy* proxy, |
const SkBitmap& src, |
const Context& ctx, |
@@ -22,8 +31,20 @@ bool SkComposeImageFilter::onFilterImage(Proxy* proxy, |
SkImageFilter* inner = getInput(1); |
SkBitmap tmp; |
- return inner->filterImage(proxy, src, ctx, &tmp, offset) && |
- outer->filterImage(proxy, tmp, ctx, result, offset); |
+ SkIPoint innerOffset = SkIPoint::Make(0, 0); |
+ SkIPoint outerOffset = SkIPoint::Make(0, 0); |
+ if (!inner->filterImage(proxy, src, ctx, &tmp, &innerOffset)) |
+ return false; |
+ |
+ SkMatrix outerMatrix(ctx.ctm()); |
+ outerMatrix.postTranslate(SkIntToScalar(-innerOffset.x()), SkIntToScalar(-innerOffset.y())); |
+ Context outerContext(outerMatrix, ctx.clipBounds(), ctx.cache()); |
+ if (!outer->filterImage(proxy, tmp, outerContext, result, &outerOffset)) { |
+ return false; |
+ } |
+ |
+ *offset = innerOffset + outerOffset; |
+ return true; |
} |
bool SkComposeImageFilter::onFilterBounds(const SkIRect& src, |