Fix MatrixImageFilter computeFastBounds
authorrobertphillips <robertphillips@google.com>
Tue, 9 Dec 2014 13:28:24 +0000 (05:28 -0800)
committerCommit bot <commit-bot@chromium.org>
Tue, 9 Dec 2014 13:28:24 +0000 (05:28 -0800)
This CL makes the bounding box returned from SkMatrixImageFilter::computeFastBounds actually contain the final result pixels. This, in turn, fixes the first two rows of the filterfastbounds GM and the SVG web page cited in the bug.

BUG=418417

Review URL: https://codereview.chromium.org/785893004

src/effects/SkMatrixImageFilter.cpp

index 919dff3..f2c403f 100644 (file)
@@ -98,11 +98,8 @@ void SkMatrixImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons
     if (getInput(0)) {
         getInput(0)->computeFastBounds(src, &bounds);
     }
-    SkMatrix matrix;
-    matrix.setTranslate(-bounds.x(), -bounds.y());
-    matrix.postConcat(fTransform);
-    matrix.postTranslate(bounds.x(), bounds.y());
-    matrix.mapRect(dst, bounds);
+    fTransform.mapRect(dst, bounds);
+    dst->join(bounds);   // Work around for skia:3194
 }
 
 bool SkMatrixImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,