Change signatures of filter bounds methods to return a rect.
Change filterBounds(), onFilterBounds() and onFilterNodeBounds() and computeFastBounds() to
return the destination rectangle. There was no code path that could
return false, and returning rects by value is ok now.
BUG=skia:5094
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1823573003
Review URL: https://codereview.chromium.org/1823573003
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 61b0c33..204f4f3 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -142,22 +142,18 @@
proxy, source, ctx, dst, offset);
}
-void SkMorphologyImageFilter::computeFastBounds(const SkRect& src, SkRect* dst) const {
- if (this->getInput(0)) {
- this->getInput(0)->computeFastBounds(src, dst);
- } else {
- *dst = src;
- }
- dst->outset(SkIntToScalar(fRadius.width()), SkIntToScalar(fRadius.height()));
+SkRect SkMorphologyImageFilter::computeFastBounds(const SkRect& src) const {
+ SkRect bounds = this->getInput(0) ? this->getInput(0)->computeFastBounds(src) : src;
+ bounds.outset(SkIntToScalar(fRadius.width()), SkIntToScalar(fRadius.height()));
+ return bounds;
}
-void SkMorphologyImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
- SkIRect* dst, MapDirection) const {
- *dst = src;
+SkIRect SkMorphologyImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
+ MapDirection) const {
SkVector radius = SkVector::Make(SkIntToScalar(this->radius().width()),
SkIntToScalar(this->radius().height()));
ctm.mapVectors(&radius, 1);
- dst->outset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radius.y()));
+ return src.makeOutset(SkScalarCeilToInt(radius.x()), SkScalarCeilToInt(radius.y()));
}
SkFlattenable* SkErodeImageFilter::CreateProc(SkReadBuffer& buffer) {