Avoid devolving to a path when conservative clipping with RRects
Review URL: https://codereview.chromium.org/1461923004
diff --git a/src/core/SkRasterClip.cpp b/src/core/SkRasterClip.cpp
index 89c22e8..ea1a7db 100644
--- a/src/core/SkRasterClip.cpp
+++ b/src/core/SkRasterClip.cpp
@@ -161,10 +161,19 @@
return this->updateCacheAndReturnNonEmpty();
}
+bool SkRasterClip::op(const SkRRect& rrect, const SkISize& size, SkRegion::Op op, bool doAA) {
+ if (fForceConservativeRects) {
+ return this->op(rrect.getBounds(), size, op, doAA);
+ }
+
+ SkPath path;
+ path.addRRect(rrect);
+
+ return this->op(path, size, op, doAA);
+}
+
bool SkRasterClip::op(const SkPath& path, const SkISize& size, SkRegion::Op op, bool doAA) {
- // base is used to limit the size (and therefore memory allocation) of the
- // region that results from scan converting devPath.
- SkRegion base;
+ AUTO_RASTERCLIP_VALIDATE(*this);
if (fForceConservativeRects) {
SkIRect ir;
@@ -181,6 +190,10 @@
return this->op(ir, op);
}
+ // base is used to limit the size (and therefore memory allocation) of the
+ // region that results from scan converting devPath.
+ SkRegion base;
+
if (SkRegion::kIntersect_Op == op) {
// since we are intersect, we can do better (tighter) with currRgn's
// bounds, than just using the device. However, if currRgn is complex,