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

Unified Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 1823573003: Change signatures of filter bounds methods to return a rect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Hide legacy API behind #ifdef; switch callers to new API Created 4 years, 9 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
Index: src/effects/SkDisplacementMapEffect.cpp
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 7940203bddba0fd9aa6a02f71b5f0358ada322c4..ab4767c64bd726d42184516dd76cc9aa7f789751 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -265,32 +265,27 @@ bool SkDisplacementMapEffect::onFilterImageDeprecated(Proxy* proxy,
return true;
}
-void SkDisplacementMapEffect::computeFastBounds(const SkRect& src, SkRect* dst) const {
- if (this->getColorInput()) {
- this->getColorInput()->computeFastBounds(src, dst);
- } else {
- *dst = src;
- }
- dst->outset(SkScalarAbs(fScale) * SK_ScalarHalf, SkScalarAbs(fScale) * SK_ScalarHalf);
+SkRect SkDisplacementMapEffect::computeFastBounds(const SkRect& src) const {
+ SkRect bounds = this->getColorInput() ? this->getColorInput()->computeFastBounds(src) : src;
+ bounds.outset(SkScalarAbs(fScale) * SK_ScalarHalf, SkScalarAbs(fScale) * SK_ScalarHalf);
+ return bounds;
}
-void SkDisplacementMapEffect::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
- SkIRect* dst, MapDirection) const {
- *dst = src;
+SkIRect SkDisplacementMapEffect::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
+ MapDirection) const {
SkVector scale = SkVector::Make(fScale, fScale);
ctm.mapVectors(&scale, 1);
- dst->outset(SkScalarCeilToInt(SkScalarAbs(scale.fX) * SK_ScalarHalf),
- SkScalarCeilToInt(SkScalarAbs(scale.fY) * SK_ScalarHalf));
+ return src.makeOutset(SkScalarCeilToInt(SkScalarAbs(scale.fX) * SK_ScalarHalf),
+ SkScalarCeilToInt(SkScalarAbs(scale.fY) * SK_ScalarHalf));
}
-bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
- SkIRect* dst, MapDirection direction) const {
+SkIRect SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
+ MapDirection direction) const {
// Recurse only into color input.
if (this->getColorInput()) {
- return this->getColorInput()->filterBounds(src, ctm, dst, direction);
+ return this->getColorInput()->filterBounds(src, ctm, direction);
}
- *dst = src;
- return true;
+ return src;
}
#ifndef SK_IGNORE_TO_STRING

Powered by Google App Engine
This is Rietveld 408576698