Fix for SkDisplacementMap::onFilterBounds().
Two problems: we were not applying the CTM to the scale parameter when
modifying clip bounds, and the recursion for onFilterBounds() must be done
in the reverse order.
BUG=370914
R=junov@chromium.org
Review URL: https://codereview.chromium.org/272643003
git-svn-id: http://skia.googlecode.com/svn/trunk@14627 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 3922244..d0f134b 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -257,11 +257,13 @@
bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
SkIRect* dst) const {
SkIRect bounds = src;
- if (getColorInput() && !getColorInput()->filterBounds(src, ctm, &bounds)) {
- return false;
+ SkVector scale = SkVector::Make(fScale, fScale);
+ ctm.mapVectors(&scale, 1);
+ bounds.outset(SkScalarCeilToInt(scale.fX * SK_ScalarHalf),
+ SkScalarCeilToInt(scale.fY * SK_ScalarHalf));
+ if (getColorInput()) {
+ return getColorInput()->filterBounds(bounds, ctm, dst);
}
- bounds.outset(SkScalarCeilToInt(fScale * SK_ScalarHalf),
- SkScalarCeilToInt(fScale * SK_ScalarHalf));
*dst = bounds;
return true;
}