Avoid devolving to a path when conservative clipping with RRects

Review URL: https://codereview.chromium.org/1461923004
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index ef7b1e7..e4fe639 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1586,10 +1586,8 @@
 
         fClipStack->clipDevRRect(transformedRRect, op, kSoft_ClipEdgeStyle == edgeStyle);
 
-        SkPath devPath;
-        devPath.addRRect(transformedRRect);
-
-        rasterclip_path(&fMCRec->fRasterClip, this, devPath, op, kSoft_ClipEdgeStyle == edgeStyle);
+        fMCRec->fRasterClip.op(transformedRRect, this->getBaseLayerSize(), op,
+                               kSoft_ClipEdgeStyle == edgeStyle);
         return;
     }
 
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,
diff --git a/src/core/SkRasterClip.h b/src/core/SkRasterClip.h
index 8a06818..4e2b141 100644
--- a/src/core/SkRasterClip.h
+++ b/src/core/SkRasterClip.h
@@ -11,6 +11,8 @@
 #include "SkRegion.h"
 #include "SkAAClip.h"
 
+class SkRRect;
+
 class SkRasterClip {
 public:
     SkRasterClip(bool forceConservativeRects = false);
@@ -44,6 +46,7 @@
     bool op(const SkIRect&, SkRegion::Op);
     bool op(const SkRegion&, SkRegion::Op);
     bool op(const SkRect&, const SkISize&, SkRegion::Op, bool doAA);
+    bool op(const SkRRect&, const SkISize&, SkRegion::Op, bool doAA);
     bool op(const SkPath&, const SkISize&, SkRegion::Op, bool doAA);
     
     void translate(int dx, int dy, SkRasterClip* dst) const;