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

Unified Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 1616663003: Fix bounds computations for SkDisplacementMapEffect with negative scale. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix onComputeFastBounds() as well Created 4 years, 11 months 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
« no previous file with comments | « gm/displacement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkDisplacementMapEffect.cpp
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 9c640e3a984fe9a62aee43f2da104b4e1bf27dff..30f980a5c639232736d80f6278ec1bc3c08d6a08 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -269,7 +269,7 @@ void SkDisplacementMapEffect::computeFastBounds(const SkRect& src, SkRect* dst)
} else {
*dst = src;
}
- dst->outset(fScale * SK_ScalarHalf, fScale * SK_ScalarHalf);
+ dst->outset(SkScalarAbs(fScale) * SK_ScalarHalf, SkScalarAbs(fScale) * SK_ScalarHalf);
}
void SkDisplacementMapEffect::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
@@ -277,8 +277,8 @@ void SkDisplacementMapEffect::onFilterNodeBounds(const SkIRect& src, const SkMat
*dst = src;
SkVector scale = SkVector::Make(fScale, fScale);
ctm.mapVectors(&scale, 1);
- dst->outset(SkScalarCeilToInt(scale.fX * SK_ScalarHalf),
- SkScalarCeilToInt(scale.fY * SK_ScalarHalf));
+ dst->outset(SkScalarCeilToInt(SkScalarAbs(scale.fX) * SK_ScalarHalf),
+ SkScalarCeilToInt(SkScalarAbs(scale.fY) * SK_ScalarHalf));
}
bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
« no previous file with comments | « gm/displacement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698