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

Unified Diff: src/core/SkMatrixImageFilter.cpp

Issue 1308703007: Fix filter primitive bounds computations. (Closed) Base URL: https://skia.googlesource.com/skia.git@saveLayer-bounds-not-transformed
Patch Set: Fix comment style; remove useless param names Created 5 years 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
Index: src/core/SkMatrixImageFilter.cpp
diff --git a/src/core/SkMatrixImageFilter.cpp b/src/core/SkMatrixImageFilter.cpp
index 4370ddadee2e42b2d9ef909b55028066ba0ebb5f..4138ccf67759f5704a5e9f43df964419a617980f 100644
--- a/src/core/SkMatrixImageFilter.cpp
+++ b/src/core/SkMatrixImageFilter.cpp
@@ -97,30 +97,33 @@ void SkMatrixImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) cons
getInput(0)->computeFastBounds(src, &bounds);
}
fTransform.mapRect(dst, bounds);
+#ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS
dst->join(bounds); // Work around for skia:3194
+#endif
}
-bool SkMatrixImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
- SkIRect* dst) const {
- SkMatrix transformInverse;
- if (!fTransform.invert(&transformInverse)) {
- return false;
- }
+void SkMatrixImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
+ SkIRect* dst, MapDirection direction) const {
SkMatrix matrix;
if (!ctm.invert(&matrix)) {
- return false;
+ *dst = src;
+ return;
+ }
+ if (kForward_MapDirection == direction) {
+ matrix.postConcat(fTransform);
+ } else {
+ SkMatrix transformInverse;
+ if (!fTransform.invert(&transformInverse)) {
+ *dst = src;
+ return;
+ }
+ matrix.postConcat(transformInverse);
}
- matrix.postConcat(transformInverse);
matrix.postConcat(ctm);
SkRect floatBounds;
matrix.mapRect(&floatBounds, SkRect::Make(src));
SkIRect bounds = floatBounds.roundOut();
- if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) {
- return false;
- }
-
*dst = bounds;
- return true;
}
#ifndef SK_IGNORE_TO_STRING

Powered by Google App Engine
This is Rietveld 408576698