Fix for rounded-rect clips with filters.
Don't use the base canvas size to limit raster of complex clips, since
the top canvas size may actually be larger (e.g., a blur filter which
expands the clip bounds to accommodate filter margins). Use the top
canvas bounds instead.
BUG=skia:4879,471212
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1657333002
Review URL: https://codereview.chromium.org/1657333002
diff --git a/src/core/SkRasterClip.cpp b/src/core/SkRasterClip.cpp
index ea1a7db..5afe279 100644
--- a/src/core/SkRasterClip.cpp
+++ b/src/core/SkRasterClip.cpp
@@ -161,18 +161,18 @@
return this->updateCacheAndReturnNonEmpty();
}
-bool SkRasterClip::op(const SkRRect& rrect, const SkISize& size, SkRegion::Op op, bool doAA) {
+bool SkRasterClip::op(const SkRRect& rrect, const SkIRect& bounds, SkRegion::Op op, bool doAA) {
if (fForceConservativeRects) {
- return this->op(rrect.getBounds(), size, op, doAA);
+ return this->op(rrect.getBounds(), bounds, op, doAA);
}
SkPath path;
path.addRRect(rrect);
- return this->op(path, size, op, doAA);
+ return this->op(path, bounds, op, doAA);
}
-bool SkRasterClip::op(const SkPath& path, const SkISize& size, SkRegion::Op op, bool doAA) {
+bool SkRasterClip::op(const SkPath& path, const SkIRect& bounds, SkRegion::Op op, bool doAA) {
AUTO_RASTERCLIP_VALIDATE(*this);
if (fForceConservativeRects) {
@@ -181,7 +181,7 @@
case kDoNothing_MutateResult:
return !this->isEmpty();
case kReplaceClippedAgainstGlobalBounds_MutateResult:
- ir = SkIRect::MakeSize(size);
+ ir = bounds;
break;
case kContinue_MutateResult:
ir = path.getBounds().roundOut();
@@ -210,7 +210,7 @@
return this->op(clip, op);
}
} else {
- base.setRect(0, 0, size.width(), size.height());
+ base.setRect(bounds);
if (SkRegion::kReplace_Op == op) {
return this->setPath(path, base, doAA);
@@ -285,7 +285,7 @@
return x - SkScalarFloorToScalar(x) < domain;
}
-bool SkRasterClip::op(const SkRect& r, const SkISize& size, SkRegion::Op op, bool doAA) {
+bool SkRasterClip::op(const SkRect& r, const SkIRect& bounds, SkRegion::Op op, bool doAA) {
AUTO_RASTERCLIP_VALIDATE(*this);
if (fForceConservativeRects) {
@@ -294,7 +294,7 @@
case kDoNothing_MutateResult:
return !this->isEmpty();
case kReplaceClippedAgainstGlobalBounds_MutateResult:
- ir = SkIRect::MakeSize(size);
+ ir = bounds;
break;
case kContinue_MutateResult:
ir = r.roundOut();