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

Unified Diff: src/effects/SkDropShadowImageFilter.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/SkDropShadowImageFilter.cpp
diff --git a/src/effects/SkDropShadowImageFilter.cpp b/src/effects/SkDropShadowImageFilter.cpp
index e2e72c1097478c39a691cd63d1b2159152340a2a..deece35b3883fe9255ba9f0f926a3e1602093da3 100644
--- a/src/effects/SkDropShadowImageFilter.cpp
+++ b/src/effects/SkDropShadowImageFilter.cpp
@@ -99,41 +99,37 @@ bool SkDropShadowImageFilter::onFilterImageDeprecated(Proxy* proxy, const SkBitm
return true;
}
-void SkDropShadowImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
- if (getInput(0)) {
- getInput(0)->computeFastBounds(src, dst);
- } else {
- *dst = src;
- }
-
- SkRect shadowBounds = *dst;
+SkRect SkDropShadowImageFilter::computeFastBounds(const SkRect& src) const {
+ SkRect bounds = this->getInput(0) ? this->getInput(0)->computeFastBounds(src) : src;
+ SkRect shadowBounds = bounds;
shadowBounds.offset(fDx, fDy);
shadowBounds.outset(SkScalarMul(fSigmaX, SkIntToScalar(3)),
SkScalarMul(fSigmaY, SkIntToScalar(3)));
if (fShadowMode == kDrawShadowAndForeground_ShadowMode) {
- dst->join(shadowBounds);
+ bounds.join(shadowBounds);
} else {
- *dst = shadowBounds;
+ bounds = shadowBounds;
}
+ return bounds;
}
-void SkDropShadowImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
- SkIRect* dst, MapDirection direction) const {
- *dst = src;
+SkIRect SkDropShadowImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
+ MapDirection direction) const {
SkVector offsetVec = SkVector::Make(fDx, fDy);
if (kReverse_MapDirection == direction) {
offsetVec.negate();
}
ctm.mapVectors(&offsetVec, 1);
- dst->offset(SkScalarCeilToInt(offsetVec.x()),
- SkScalarCeilToInt(offsetVec.y()));
+ SkIRect dst = src.makeOffset(SkScalarCeilToInt(offsetVec.x()),
+ SkScalarCeilToInt(offsetVec.y()));
SkVector sigma = SkVector::Make(fSigmaX, fSigmaY);
ctm.mapVectors(&sigma, 1);
- dst->outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))),
+ dst.outset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))),
SkScalarCeilToInt(SkScalarMul(sigma.y(), SkIntToScalar(3))));
if (fShadowMode == kDrawShadowAndForeground_ShadowMode) {
- dst->join(src);
+ dst.join(src);
}
+ return dst;
}
#ifndef SK_IGNORE_TO_STRING

Powered by Google App Engine
This is Rietveld 408576698