add new onClip* methods to SkCanvas

https://codereview.chromium.org/183453002/



git-svn-id: http://skia.googlecode.com/svn/trunk@13627 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkBBoxHierarchyRecord.cpp b/src/core/SkBBoxHierarchyRecord.cpp
index b120b1d..5d310be 100644
--- a/src/core/SkBBoxHierarchyRecord.cpp
+++ b/src/core/SkBBoxHierarchyRecord.cpp
@@ -77,31 +77,31 @@
     fStateTree->appendTransform(getTotalMatrix());
 }
 
-bool SkBBoxHierarchyRecord::clipRect(const SkRect& rect,
-                                     SkRegion::Op op,
-                                     bool doAntiAlias) {
+void SkBBoxHierarchyRecord::onClipRect(const SkRect& rect,
+                                       SkRegion::Op op,
+                                       ClipEdgeStyle edgeStyle) {
     fStateTree->appendClip(this->writeStream().bytesWritten());
-    return INHERITED::clipRect(rect, op, doAntiAlias);
+    this->INHERITED::onClipRect(rect, op, edgeStyle);
 }
 
-bool SkBBoxHierarchyRecord::clipRegion(const SkRegion& region,
-                                       SkRegion::Op op) {
+void SkBBoxHierarchyRecord::onClipRegion(const SkRegion& region,
+                                         SkRegion::Op op) {
     fStateTree->appendClip(this->writeStream().bytesWritten());
-    return INHERITED::clipRegion(region, op);
+    this->INHERITED::onClipRegion(region, op);
 }
 
-bool SkBBoxHierarchyRecord::clipPath(const SkPath& path,
-                                     SkRegion::Op op,
-                                     bool doAntiAlias) {
+void SkBBoxHierarchyRecord::onClipPath(const SkPath& path,
+                                       SkRegion::Op op,
+                                       ClipEdgeStyle edgeStyle) {
     fStateTree->appendClip(this->writeStream().bytesWritten());
-    return INHERITED::clipPath(path, op, doAntiAlias);
+    this->INHERITED::onClipPath(path, op, edgeStyle);
 }
 
-bool SkBBoxHierarchyRecord::clipRRect(const SkRRect& rrect,
-                                      SkRegion::Op op,
-                                      bool doAntiAlias) {
+void SkBBoxHierarchyRecord::onClipRRect(const SkRRect& rrect,
+                                        SkRegion::Op op,
+                                        ClipEdgeStyle edgeStyle) {
     fStateTree->appendClip(this->writeStream().bytesWritten());
-    return INHERITED::clipRRect(rrect, op, doAntiAlias);
+    this->INHERITED::onClipRRect(rrect, op, edgeStyle);
 }
 
 bool SkBBoxHierarchyRecord::shouldRewind(void* data) {
diff --git a/src/core/SkBBoxHierarchyRecord.h b/src/core/SkBBoxHierarchyRecord.h
index f264334..80f59c3 100644
--- a/src/core/SkBBoxHierarchyRecord.h
+++ b/src/core/SkBBoxHierarchyRecord.h
@@ -35,21 +35,15 @@
     virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
     virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
 
-    virtual bool clipRect(const SkRect& rect,
-                          SkRegion::Op op = SkRegion::kIntersect_Op,
-                          bool doAntiAlias = false) SK_OVERRIDE;
-    virtual bool clipRegion(const SkRegion& region,
-                            SkRegion::Op op = SkRegion::kIntersect_Op) SK_OVERRIDE;
-    virtual bool clipPath(const SkPath& path,
-                          SkRegion::Op op = SkRegion::kIntersect_Op,
-                          bool doAntiAlias = false) SK_OVERRIDE;
-    virtual bool clipRRect(const SkRRect& rrect,
-                           SkRegion::Op op = SkRegion::kIntersect_Op,
-                           bool doAntiAlias = false) SK_OVERRIDE;
-
     // Implementation of the SkBBoxHierarchyClient interface
     virtual bool shouldRewind(void* data) SK_OVERRIDE;
 
+protected:
+    virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
+
 private:
     typedef SkBBoxRecord INHERITED;
 };
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index bc14974..96d16fc 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1166,6 +1166,12 @@
 //////////////////////////////////////////////////////////////////////////////
 
 bool SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
+    ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
+    this->onClipRect(rect, op, edgeStyle);
+    return !this->isClipEmpty();
+}
+
+void SkCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
 #ifdef SK_ENABLE_CLIP_QUICKREJECT
     if (SkRegion::kIntersect_Op == op) {
         if (fMCRec->fRasterClip->isEmpty()) {
@@ -1186,7 +1192,9 @@
 
     fDeviceCMDirty = true;
     fCachedLocalClipBoundsDirty = true;
-    doAA &= fAllowSoftClip;
+    if (!fAllowSoftClip) {
+        edgeStyle = kHard_ClipEdgeStyle;
+    }
 
     if (fMCRec->fMatrix->rectStaysRect()) {
         // for these simpler matrices, we can stay a rect even after applying
@@ -1196,8 +1204,8 @@
         SkRect      r;
 
         fMCRec->fMatrix->mapRect(&r, rect);
-        fClipStack.clipDevRect(r, op, doAA);
-        return fMCRec->fRasterClip->op(r, op, doAA);
+        fClipStack.clipDevRect(r, op, kSoft_ClipEdgeStyle == edgeStyle);
+        fMCRec->fRasterClip->op(r, op, kSoft_ClipEdgeStyle == edgeStyle);
     } else {
         // since we're rotated or some such thing, we convert the rect to a path
         // and clip against that, since it can handle any matrix. However, to
@@ -1206,12 +1214,12 @@
         SkPath  path;
 
         path.addRect(rect);
-        return this->SkCanvas::clipPath(path, op, doAA);
+        this->SkCanvas::onClipPath(path, op, edgeStyle);
     }
 }
 
-static bool clipPathHelper(const SkCanvas* canvas, SkRasterClip* currClip,
-                           const SkPath& devPath, SkRegion::Op op, bool doAA) {
+static void clip_path_helper(const SkCanvas* canvas, SkRasterClip* currClip,
+                             const SkPath& devPath, 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;
@@ -1224,60 +1232,81 @@
             // FIXME: we should also be able to do this when currClip->isBW(),
             // but relaxing the test above triggers GM asserts in
             // SkRgnBuilder::blitH(). We need to investigate what's going on.
-            return currClip->setPath(devPath, currClip->bwRgn(), doAA);
+            currClip->setPath(devPath, currClip->bwRgn(), doAA);
         } else {
             base.setRect(currClip->getBounds());
             SkRasterClip clip;
             clip.setPath(devPath, base, doAA);
-            return currClip->op(clip, op);
+            currClip->op(clip, op);
         }
     } else {
         const SkBaseDevice* device = canvas->getDevice();
         if (!device) {
-            return currClip->setEmpty();
+            currClip->setEmpty();
+            return;
         }
 
         base.setRect(0, 0, device->width(), device->height());
 
         if (SkRegion::kReplace_Op == op) {
-            return currClip->setPath(devPath, base, doAA);
+            currClip->setPath(devPath, base, doAA);
         } else {
             SkRasterClip clip;
             clip.setPath(devPath, base, doAA);
-            return currClip->op(clip, op);
+            currClip->op(clip, op);
         }
     }
 }
 
 bool SkCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+    ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
     if (rrect.isRect()) {
-        // call the non-virtual version
-        return this->SkCanvas::clipRect(rrect.getBounds(), op, doAA);
+        this->onClipRect(rrect.getBounds(), op, edgeStyle);
+    } else {
+        this->onClipRRect(rrect, op, edgeStyle);
     }
+    return !this->isClipEmpty();
+}
 
+void SkCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     SkRRect transformedRRect;
     if (rrect.transform(*fMCRec->fMatrix, &transformedRRect)) {
         AutoValidateClip avc(this);
 
         fDeviceCMDirty = true;
         fCachedLocalClipBoundsDirty = true;
-        doAA &= fAllowSoftClip;
+        if (!fAllowSoftClip) {
+            edgeStyle = kHard_ClipEdgeStyle;
+        }
 
-        fClipStack.clipDevRRect(transformedRRect, op, doAA);
+        fClipStack.clipDevRRect(transformedRRect, op, kSoft_ClipEdgeStyle == edgeStyle);
 
         SkPath devPath;
         devPath.addRRect(transformedRRect);
 
-        return clipPathHelper(this, fMCRec->fRasterClip, devPath, op, doAA);
+        clip_path_helper(this, fMCRec->fRasterClip, devPath, op, kSoft_ClipEdgeStyle == edgeStyle);
+        return;
     }
 
     SkPath path;
     path.addRRect(rrect);
     // call the non-virtual version
-    return this->SkCanvas::clipPath(path, op, doAA);
+    this->SkCanvas::onClipPath(path, op, edgeStyle);
 }
 
 bool SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
+    ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
+    SkRect r;
+    if (!path.isInverseFillType() && path.isRect(&r)) {
+        this->onClipRect(r, op, edgeStyle);
+    } else {
+        this->onClipPath(path, op, edgeStyle);
+    }
+
+    return !this->isClipEmpty();
+}
+
+void SkCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
 #ifdef SK_ENABLE_CLIP_QUICKREJECT
     if (SkRegion::kIntersect_Op == op && !path.isInverseFillType()) {
         if (fMCRec->fRasterClip->isEmpty()) {
@@ -1298,7 +1327,9 @@
 
     fDeviceCMDirty = true;
     fCachedLocalClipBoundsDirty = true;
-    doAA &= fAllowSoftClip;
+    if (!fAllowSoftClip) {
+        edgeStyle = kHard_ClipEdgeStyle;
+    }
 
     SkPath devPath;
     path.transform(*fMCRec->fMatrix, &devPath);
@@ -1314,7 +1345,7 @@
     }
 
     // if we called path.swap() we could avoid a deep copy of this path
-    fClipStack.clipDevPath(devPath, op, doAA);
+    fClipStack.clipDevPath(devPath, op, kSoft_ClipEdgeStyle == edgeStyle);
 
     if (fAllowSimplifyClip) {
         devPath.reset();
@@ -1338,12 +1369,14 @@
             // if the prev and curr clips disagree about aa -vs- not, favor the aa request.
             // perhaps we need an API change to avoid this sort of mixed-signals about
             // clipping.
-            doAA |= element->isAA();
+            if (element->isAA()) {
+                edgeStyle = kSoft_ClipEdgeStyle;
+            }
         }
         op = SkRegion::kReplace_Op;
     }
 
-    return clipPathHelper(this, fMCRec->fRasterClip, devPath, op, doAA);
+    clip_path_helper(this, fMCRec->fRasterClip, devPath, op, edgeStyle);
 }
 
 bool SkCanvas::updateClipConservativelyUsingBounds(const SkRect& bounds, SkRegion::Op op,
@@ -1369,13 +1402,12 @@
             case SkRegion::kIntersect_Op:
             case SkRegion::kDifference_Op:
                 // These ops can only shrink the current clip. So leaving
-                // the clip unchanges conservatively respects the contract.
-                return this->getClipDeviceBounds(NULL);
+                // the clip unchanged conservatively respects the contract.
+                break;
             case SkRegion::kUnion_Op:
             case SkRegion::kReplace_Op:
             case SkRegion::kReverseDifference_Op:
-            case SkRegion::kXOR_Op:
-                {
+            case SkRegion::kXOR_Op: {
                     // These ops can grow the current clip up to the extents of
                     // the input clip, which is inverse filled, so we just set
                     // the current clip to the device bounds.
@@ -1386,11 +1418,11 @@
                     this->SkCanvas::save(SkCanvas::kMatrix_SaveFlag);
                     // set the clip in device space
                     this->SkCanvas::setMatrix(SkMatrix::I());
-                    bool result = this->SkCanvas::clipRect(deviceBounds,
-                        SkRegion::kReplace_Op, false);
+                    this->SkCanvas::onClipRect(deviceBounds, SkRegion::kReplace_Op, 
+                                               kHard_ClipEdgeStyle);
                     this->SkCanvas::restore(); //pop the matrix, but keep the clip
-                    return result;
-                }
+                    break;
+            }
             default:
                 SkASSERT(0); // unhandled op?
         }
@@ -1400,27 +1432,36 @@
             case SkRegion::kIntersect_Op:
             case SkRegion::kUnion_Op:
             case SkRegion::kReplace_Op:
-                return this->SkCanvas::clipRect(bounds, op, false);
+                this->SkCanvas::onClipRect(bounds, op, kHard_ClipEdgeStyle);
+                break;
             case SkRegion::kDifference_Op:
                 // Difference can only shrink the current clip.
                 // Leaving clip unchanged conservatively fullfills the contract.
-                return this->getClipDeviceBounds(NULL);
+                break;
             case SkRegion::kReverseDifference_Op:
                 // To reverse, we swap in the bounds with a replace op.
                 // As with difference, leave it unchanged.
-                return this->SkCanvas::clipRect(bounds, SkRegion::kReplace_Op, false);
+                this->SkCanvas::onClipRect(bounds, SkRegion::kReplace_Op, kHard_ClipEdgeStyle);
+                break;
             case SkRegion::kXOR_Op:
                 // Be conservative, based on (A XOR B) always included in (A union B),
                 // which is always included in (bounds(A) union bounds(B))
-                return this->SkCanvas::clipRect(bounds, SkRegion::kUnion_Op, false);
+                this->SkCanvas::onClipRect(bounds, SkRegion::kUnion_Op, kHard_ClipEdgeStyle);
+                break;
             default:
                 SkASSERT(0); // unhandled op?
         }
     }
-    return true;
+
+    return !this->isClipEmpty();
 }
 
 bool SkCanvas::clipRegion(const SkRegion& rgn, SkRegion::Op op) {
+    this->onClipRegion(rgn, op);
+    return !this->isClipEmpty();
+}
+
+void SkCanvas::onClipRegion(const SkRegion& rgn, SkRegion::Op op) {
     AutoValidateClip avc(this);
 
     fDeviceCMDirty = true;
@@ -1430,7 +1471,7 @@
     // we have to ignore it, and use the region directly?
     fClipStack.clipDevRect(rgn.getBounds(), op);
 
-    return fMCRec->fRasterClip->op(rgn, op);
+    fMCRec->fRasterClip->op(rgn, op);
 }
 
 #ifdef SK_DEBUG
@@ -1460,11 +1501,7 @@
             default: {
                 SkPath path;
                 element->asPath(&path);
-                clipPathHelper(this,
-                               &tmpClip,
-                               path,
-                               element->getOp(),
-                               element->isAA());
+                clip_path_helper(this, &tmpClip, path, element->getOp(), element->isAA());
                 break;
             }
         }
@@ -1543,7 +1580,7 @@
 
 bool SkCanvas::getClipBounds(SkRect* bounds) const {
     SkIRect ibounds;
-    if (!getClipDeviceBounds(&ibounds)) {
+    if (!this->getClipDeviceBounds(&ibounds)) {
         return false;
     }
 
@@ -1588,8 +1625,12 @@
 }
 
 SkCanvas::ClipType SkCanvas::getClipType() const {
-    if (fMCRec->fRasterClip->isEmpty()) return kEmpty_ClipType;
-    if (fMCRec->fRasterClip->isRect()) return kRect_ClipType;
+    if (fMCRec->fRasterClip->isEmpty()) {
+        return kEmpty_ClipType;
+    }
+    if (fMCRec->fRasterClip->isRect()) {
+        return kRect_ClipType;
+    }
     return kComplex_ClipType;
 }
 
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index a8279ca..f170476 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -819,7 +819,8 @@
                 size_t offsetToRestore = reader.readInt();
                 SkASSERT(!offsetToRestore || \
                     offsetToRestore >= reader.offset());
-                if (!canvas.clipPath(path, regionOp, doAA) && offsetToRestore) {
+                canvas.clipPath(path, regionOp, doAA);
+                if (canvas.isClipEmpty() && offsetToRestore) {
 #ifdef SPEW_CLIP_SKIPPING
                     skipPath.recordSkip(offsetToRestore - reader.offset());
 #endif
@@ -834,7 +835,8 @@
                 size_t offsetToRestore = reader.readInt();
                 SkASSERT(!offsetToRestore || \
                     offsetToRestore >= reader.offset());
-                if (!canvas.clipRegion(region, regionOp) && offsetToRestore) {
+                canvas.clipRegion(region, regionOp);
+                if (canvas.isClipEmpty() && offsetToRestore) {
 #ifdef SPEW_CLIP_SKIPPING
                     skipRegion.recordSkip(offsetToRestore - reader.offset());
 #endif
@@ -849,7 +851,8 @@
                 size_t offsetToRestore = reader.readInt();
                 SkASSERT(!offsetToRestore || \
                          offsetToRestore >= reader.offset());
-                if (!canvas.clipRect(rect, regionOp, doAA) && offsetToRestore) {
+                canvas.clipRect(rect, regionOp, doAA);
+                if (canvas.isClipEmpty() && offsetToRestore) {
 #ifdef SPEW_CLIP_SKIPPING
                     skipRect.recordSkip(offsetToRestore - reader.offset());
 #endif
@@ -865,7 +868,8 @@
                 size_t offsetToRestore = reader.readInt();
                 SkASSERT(!offsetToRestore || \
                          offsetToRestore >= reader.offset());
-                if (!canvas.clipRRect(rrect, regionOp, doAA) && offsetToRestore) {
+                canvas.clipRRect(rrect, regionOp, doAA);
+                if (canvas.isClipEmpty() && offsetToRestore) {
 #ifdef SPEW_CLIP_SKIPPING
                     skipRRect.recordSkip(offsetToRestore - reader.offset());
 #endif
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 978e2b3..dda6f46 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -847,14 +847,14 @@
 }
 #endif
 
-bool SkPictureRecord::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
+void SkPictureRecord::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
 
 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
     fMCMgr.clipRect(rect, op, doAA);
 #else
-    this->recordClipRect(rect, op, doAA);
+    this->recordClipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle);
 #endif
-    return this->INHERITED::clipRect(rect, op, doAA);
+    this->INHERITED::onClipRect(rect, op, edgeStyle);
 }
 
 int SkPictureRecord::recordClipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
@@ -878,20 +878,17 @@
     return offset;
 }
 
-bool SkPictureRecord::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
-    if (rrect.isRect()) {
-        return this->SkPictureRecord::clipRect(rrect.getBounds(), op, doAA);
-    }
+void SkPictureRecord::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
 
 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
     fMCMgr.clipRRect(rrect, op, doAA);
 #else
-    this->recordClipRRect(rrect, op, doAA);
+    this->recordClipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle);
 #endif
     if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) {
-        return this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false);
+        this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false);
     } else {
-        return this->INHERITED::clipRRect(rrect, op, doAA);
+        this->INHERITED::onClipRRect(rrect, op, edgeStyle);
     }
 }
 
@@ -915,25 +912,20 @@
     return offset;
 }
 
-bool SkPictureRecord::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
-
-    SkRect r;
-    if (!path.isInverseFillType() && path.isRect(&r)) {
-        return this->clipRect(r, op, doAA);
-    }
+void SkPictureRecord::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
 
 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
     fMCMgr.clipPath(path, op, doAA);
 #else
     int pathID = this->addPathToHeap(path);
-    this->recordClipPath(pathID, op, doAA);
+    this->recordClipPath(pathID, op, kSoft_ClipEdgeStyle == edgeStyle);
 #endif
 
     if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) {
-        return this->updateClipConservativelyUsingBounds(path.getBounds(), op,
-                                                         path.isInverseFillType());
+        this->updateClipConservativelyUsingBounds(path.getBounds(), op,
+                                                  path.isInverseFillType());
     } else {
-        return this->INHERITED::clipPath(path, op, doAA);
+        this->INHERITED::onClipPath(path, op, edgeStyle);
     }
 }
 
@@ -957,14 +949,14 @@
     return offset;
 }
 
-bool SkPictureRecord::clipRegion(const SkRegion& region, SkRegion::Op op) {
+void SkPictureRecord::onClipRegion(const SkRegion& region, SkRegion::Op op) {
 
 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
     fMCMgr.clipRegion(region, op);
 #else
     this->recordClipRegion(region, op);
 #endif
-    return this->INHERITED::clipRegion(region, op);
+    this->INHERITED::onClipRegion(region, op);
 }
 
 int SkPictureRecord::recordClipRegion(const SkRegion& region, SkRegion::Op op) {
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index dc439a1..1b62f3d 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -45,10 +45,6 @@
     virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE;
     virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
     virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
-    virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
-    virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE;
-    virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
-    virtual bool clipRegion(const SkRegion& region, SkRegion::Op op) SK_OVERRIDE;
     virtual void clear(SkColor) SK_OVERRIDE;
     virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
     virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
@@ -228,6 +224,11 @@
     virtual void onPushCull(const SkRect&) SK_OVERRIDE;
     virtual void onPopCull() SK_OVERRIDE;
 
+    virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
+
     // Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been
     // tweaked by paint.computeFastBounds().
     static void ComputeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbot[2]);
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 879ce82..43209f6 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -240,11 +240,6 @@
     virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE;
     virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
     virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
-    virtual bool clipRect(const SkRect&, SkRegion::Op op, bool doAntiAlias = false) SK_OVERRIDE;
-    virtual bool clipRRect(const SkRRect&, SkRegion::Op op, bool doAntiAlias = false) SK_OVERRIDE;
-    virtual bool clipPath(const SkPath& path, SkRegion::Op op,
-                          bool doAntiAlias = false) SK_OVERRIDE;
-    virtual bool clipRegion(const SkRegion& region, SkRegion::Op op) SK_OVERRIDE;
     virtual void clear(SkColor) SK_OVERRIDE;
     virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;
     virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
@@ -294,6 +289,11 @@
 protected:
     virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
 
+    virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
+
 private:
     enum {
         kNoSaveLayer = -1,
@@ -635,47 +635,56 @@
     this->INHERITED::setMatrix(matrix);
 }
 
-bool SkGPipeCanvas::clipRect(const SkRect& rect, SkRegion::Op rgnOp,
-                             bool doAntiAlias) {
+void SkGPipeCanvas::onClipRect(const SkRect& rect, SkRegion::Op rgnOp,
+                               ClipEdgeStyle edgeStyle) {
     NOTIFY_SETUP(this);
     if (this->needOpBytes(sizeof(SkRect))) {
-        unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag;
+        unsigned flags = 0;
+        if (kSoft_ClipEdgeStyle == edgeStyle) {
+            flags = kClip_HasAntiAlias_DrawOpFlag;
+        }
         this->writeOp(kClipRect_DrawOp, flags, rgnOp);
         fWriter.writeRect(rect);
     }
-    return this->INHERITED::clipRect(rect, rgnOp, doAntiAlias);
+    this->INHERITED::onClipRect(rect, rgnOp, edgeStyle);
 }
 
-bool SkGPipeCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op rgnOp,
-                              bool doAntiAlias) {
+void SkGPipeCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op rgnOp,
+                                ClipEdgeStyle edgeStyle) {
     NOTIFY_SETUP(this);
     if (this->needOpBytes(kSizeOfFlatRRect)) {
-        unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag;
+        unsigned flags = 0;
+        if (kSoft_ClipEdgeStyle == edgeStyle) {
+            flags = kClip_HasAntiAlias_DrawOpFlag;
+        }
         this->writeOp(kClipRRect_DrawOp, flags, rgnOp);
         fWriter.writeRRect(rrect);
     }
-    return this->INHERITED::clipRRect(rrect, rgnOp, doAntiAlias);
+    this->INHERITED::onClipRRect(rrect, rgnOp, edgeStyle);
 }
 
-bool SkGPipeCanvas::clipPath(const SkPath& path, SkRegion::Op rgnOp,
-                             bool doAntiAlias) {
+void SkGPipeCanvas::onClipPath(const SkPath& path, SkRegion::Op rgnOp,
+                               ClipEdgeStyle edgeStyle) {
     NOTIFY_SETUP(this);
     if (this->needOpBytes(path.writeToMemory(NULL))) {
-        unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag;
+        unsigned flags = 0;
+        if (kSoft_ClipEdgeStyle == edgeStyle) {
+            flags = kClip_HasAntiAlias_DrawOpFlag;
+        }
         this->writeOp(kClipPath_DrawOp, flags, rgnOp);
         fWriter.writePath(path);
     }
     // we just pass on the bounds of the path
-    return this->INHERITED::clipRect(path.getBounds(), rgnOp, doAntiAlias);
+    this->INHERITED::onClipRect(path.getBounds(), rgnOp, edgeStyle);
 }
 
-bool SkGPipeCanvas::clipRegion(const SkRegion& region, SkRegion::Op rgnOp) {
+void SkGPipeCanvas::onClipRegion(const SkRegion& region, SkRegion::Op rgnOp) {
     NOTIFY_SETUP(this);
     if (this->needOpBytes(region.writeToMemory(NULL))) {
         this->writeOp(kClipRegion_DrawOp, 0, rgnOp);
         fWriter.writeRegion(region);
     }
-    return this->INHERITED::clipRegion(region, rgnOp);
+    this->INHERITED::onClipRegion(region, rgnOp);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
diff --git a/src/utils/SkCanvasStack.cpp b/src/utils/SkCanvasStack.cpp
index 8951149..d85f34b 100644
--- a/src/utils/SkCanvasStack.cpp
+++ b/src/utils/SkCanvasStack.cpp
@@ -77,25 +77,22 @@
     this->SkCanvas::setMatrix(matrix);
 }
 
-bool SkCanvasStack::clipRect(const SkRect& r, SkRegion::Op op, bool aa) {
-    bool result = this->INHERITED::clipRect(r, op, aa);
+void SkCanvasStack::onClipRect(const SkRect& r, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+    this->INHERITED::onClipRect(r, op, edgeStyle);
     this->clipToZOrderedBounds();
-    return result;
 }
 
-bool SkCanvasStack::clipRRect(const SkRRect& rr, SkRegion::Op op, bool aa) {
-    bool result = this->INHERITED::clipRRect(rr, op, aa);
+void SkCanvasStack::onClipRRect(const SkRRect& rr, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+    this->INHERITED::onClipRRect(rr, op, edgeStyle);
     this->clipToZOrderedBounds();
-    return result;
 }
 
-bool SkCanvasStack::clipPath(const SkPath& p, SkRegion::Op op, bool aa) {
-    bool result = this->INHERITED::clipPath(p, op, aa);
+void SkCanvasStack::onClipPath(const SkPath& p, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+    this->INHERITED::onClipPath(p, op, edgeStyle);
     this->clipToZOrderedBounds();
-    return result;
 }
 
-bool SkCanvasStack::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
+void SkCanvasStack::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
     SkASSERT(fList.count() == fCanvasData.count());
     for (int i = 0; i < fList.count(); ++i) {
         SkRegion tempRegion;
@@ -104,5 +101,5 @@
         tempRegion.op(fCanvasData[i].requiredClip, SkRegion::kIntersect_Op);
         fList[i]->clipRegion(tempRegion, op);
     }
-    return this->SkCanvas::clipRegion(deviceRgn, op);
+    this->SkCanvas::onClipRegion(deviceRgn, op);
 }
diff --git a/src/utils/SkCanvasStack.h b/src/utils/SkCanvasStack.h
index 5311118..ba2fed4 100644
--- a/src/utils/SkCanvasStack.h
+++ b/src/utils/SkCanvasStack.h
@@ -30,11 +30,12 @@
     virtual void removeCanvas(SkCanvas*) SK_OVERRIDE { SkDEBUGFAIL("Invalid Op"); }
 
     virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
-    virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
-    virtual bool clipRRect(const SkRRect&, SkRegion::Op, bool) SK_OVERRIDE;
-    virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
-    virtual bool clipRegion(const SkRegion& deviceRgn,
-                            SkRegion::Op) SK_OVERRIDE;
+
+protected:
+    virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE;
 
 private:
     void clipToZOrderedBounds();
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 3911fd0..09494c9 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -789,39 +789,34 @@
     this->recordedDrawCommand();
 }
 
-bool SkDeferredCanvas::clipRect(const SkRect& rect,
-                                SkRegion::Op op,
-                                bool doAntiAlias) {
-    this->drawingCanvas()->clipRect(rect, op, doAntiAlias);
-    bool val = this->INHERITED::clipRect(rect, op, doAntiAlias);
+void SkDeferredCanvas::onClipRect(const SkRect& rect,
+                                  SkRegion::Op op,
+                                  ClipEdgeStyle edgeStyle) {
+    this->drawingCanvas()->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle);
+    this->INHERITED::onClipRect(rect, op, edgeStyle);
     this->recordedDrawCommand();
-    return val;
 }
 
-bool SkDeferredCanvas::clipRRect(const SkRRect& rrect,
-                                 SkRegion::Op op,
-                                 bool doAntiAlias) {
-    this->drawingCanvas()->clipRRect(rrect, op, doAntiAlias);
-    bool val = this->INHERITED::clipRRect(rrect, op, doAntiAlias);
+void SkDeferredCanvas::onClipRRect(const SkRRect& rrect,
+                                   SkRegion::Op op,
+                                   ClipEdgeStyle edgeStyle) {
+    this->drawingCanvas()->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle);
+    this->INHERITED::onClipRRect(rrect, op, edgeStyle);
     this->recordedDrawCommand();
-    return val;
 }
 
-bool SkDeferredCanvas::clipPath(const SkPath& path,
-                                SkRegion::Op op,
-                                bool doAntiAlias) {
-    this->drawingCanvas()->clipPath(path, op, doAntiAlias);
-    bool val = this->INHERITED::clipPath(path, op, doAntiAlias);
+void SkDeferredCanvas::onClipPath(const SkPath& path,
+                                  SkRegion::Op op,
+                                  ClipEdgeStyle edgeStyle) {
+    this->drawingCanvas()->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle);
+    this->INHERITED::onClipPath(path, op, edgeStyle);
     this->recordedDrawCommand();
-    return val;
 }
 
-bool SkDeferredCanvas::clipRegion(const SkRegion& deviceRgn,
-                                  SkRegion::Op op) {
+void SkDeferredCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
     this->drawingCanvas()->clipRegion(deviceRgn, op);
-    bool val = this->INHERITED::clipRegion(deviceRgn, op);
+    this->INHERITED::onClipRegion(deviceRgn, op);
     this->recordedDrawCommand();
-    return val;
 }
 
 void SkDeferredCanvas::clear(SkColor color) {
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index d768137..4805d62 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -261,40 +261,40 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-static const char* bool_to_aastring(bool doAA) {
-    return doAA ? "AA" : "BW";
+const char* SkDumpCanvas::EdgeStyleToAAString(ClipEdgeStyle edgeStyle) {
+    return kSoft_ClipEdgeStyle == edgeStyle ? "AA" : "BW";
 }
 
-bool SkDumpCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
+void SkDumpCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     SkString str;
     toString(rect, &str);
     this->dump(kClip_Verb, NULL, "clipRect(%s %s %s)", str.c_str(), toString(op),
-               bool_to_aastring(doAA));
-    return this->INHERITED::clipRect(rect, op, doAA);
+               EdgeStyleToAAString(edgeStyle));
+    this->INHERITED::onClipRect(rect, op, edgeStyle);
 }
 
-bool SkDumpCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+void SkDumpCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     SkString str;
     toString(rrect, &str);
     this->dump(kClip_Verb, NULL, "clipRRect(%s %s %s)", str.c_str(), toString(op),
-               bool_to_aastring(doAA));
-    return this->INHERITED::clipRRect(rrect, op, doAA);
+               EdgeStyleToAAString(edgeStyle));
+    this->INHERITED::onClipRRect(rrect, op, edgeStyle);
 }
 
-bool SkDumpCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
+void SkDumpCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     SkString str;
     toString(path, &str);
     this->dump(kClip_Verb, NULL, "clipPath(%s %s %s)", str.c_str(), toString(op),
-               bool_to_aastring(doAA));
-    return this->INHERITED::clipPath(path, op, doAA);
+               EdgeStyleToAAString(edgeStyle));
+    this->INHERITED::onClipPath(path, op, edgeStyle);
 }
 
-bool SkDumpCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
+void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
     SkString str;
     toString(deviceRgn, &str);
     this->dump(kClip_Verb, NULL, "clipRegion(%s %s)", str.c_str(),
                toString(op));
-    return this->INHERITED::clipRegion(deviceRgn, op);
+    this->INHERITED::onClipRegion(deviceRgn, op);
 }
 
 void SkDumpCanvas::onPushCull(const SkRect& cullRect) {
diff --git a/src/utils/SkLuaCanvas.cpp b/src/utils/SkLuaCanvas.cpp
index 8c25dc0..0f13073 100644
--- a/src/utils/SkLuaCanvas.cpp
+++ b/src/utils/SkLuaCanvas.cpp
@@ -139,30 +139,30 @@
     this->INHERITED::setMatrix(matrix);
 }
 
-bool SkLuaCanvas::clipRect(const SkRect& r, SkRegion::Op op, bool doAA) {
+void SkLuaCanvas::onClipRect(const SkRect& r, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     AUTO_LUA("clipRect");
     lua.pushRect(r, "rect");
-    lua.pushBool(doAA, "aa");
-    return this->INHERITED::clipRect(r, op, doAA);
+    lua.pushBool(kSoft_ClipEdgeStyle == edgeStyle, "aa");
+    this->INHERITED::onClipRect(r, op, edgeStyle);
 }
 
-bool SkLuaCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+void SkLuaCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     AUTO_LUA("clipRRect");
     lua.pushRRect(rrect, "rrect");
-    lua.pushBool(doAA, "aa");
-    return this->INHERITED::clipRRect(rrect, op, doAA);
+    lua.pushBool(kSoft_ClipEdgeStyle == edgeStyle, "aa");
+    this->INHERITED::onClipRRect(rrect, op, edgeStyle);
 }
 
-bool SkLuaCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
+void SkLuaCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     AUTO_LUA("clipPath");
     lua.pushPath(path, "path");
-    lua.pushBool(doAA, "aa");
-    return this->INHERITED::clipPath(path, op, doAA);
+    lua.pushBool(kSoft_ClipEdgeStyle == edgeStyle, "aa");
+    this->INHERITED::onClipPath(path, op, edgeStyle);
 }
 
-bool SkLuaCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
+void SkLuaCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
     AUTO_LUA("clipRegion");
-    return this->INHERITED::clipRegion(deviceRgn, op);
+    this->INHERITED::onClipRegion(deviceRgn, op);
 }
 
 void SkLuaCanvas::drawPaint(const SkPaint& paint) {
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index 27adc6d..a9543f9 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -130,36 +130,36 @@
     this->INHERITED::setMatrix(matrix);
 }
 
-bool SkNWayCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
+void SkNWayCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     Iter iter(fList);
     while (iter.next()) {
-        iter->clipRect(rect, op, doAA);
+        iter->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle);
     }
-    return this->INHERITED::clipRect(rect, op, doAA);
+    this->INHERITED::onClipRect(rect, op, edgeStyle);
 }
 
-bool SkNWayCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
+void SkNWayCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     Iter iter(fList);
     while (iter.next()) {
-        iter->clipRRect(rrect, op, doAA);
+        iter->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle);
     }
-    return this->INHERITED::clipRRect(rrect, op, doAA);
+    this->INHERITED::onClipRRect(rrect, op, edgeStyle);
 }
 
-bool SkNWayCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
+void SkNWayCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     Iter iter(fList);
     while (iter.next()) {
-        iter->clipPath(path, op, doAA);
+        iter->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle);
     }
-    return this->INHERITED::clipPath(path, op, doAA);
+    this->INHERITED::onClipPath(path, op, edgeStyle);
 }
 
-bool SkNWayCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
+void SkNWayCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
     Iter iter(fList);
     while (iter.next()) {
         iter->clipRegion(deviceRgn, op);
     }
-    return this->INHERITED::clipRegion(deviceRgn, op);
+    this->INHERITED::onClipRegion(deviceRgn, op);
 }
 
 void SkNWayCanvas::clear(SkColor color) {
diff --git a/src/utils/SkNoSaveLayerCanvas.h b/src/utils/SkNoSaveLayerCanvas.h
index 58d28b4..60fad87 100644
--- a/src/utils/SkNoSaveLayerCanvas.h
+++ b/src/utils/SkNoSaveLayerCanvas.h
@@ -32,25 +32,20 @@
         return count;
     }
 
+protected:
     // disable aa for speed
-    virtual bool clipRect(const SkRect& rect,
-                          SkRegion::Op op,
-                          bool doAA) SK_OVERRIDE {
-        return this->INHERITED::clipRect(rect, op, false);
+    virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
+        this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle);
     }
 
     // for speed, just respect the bounds, and disable AA. May give us a few
     // false positives and negatives.
-    virtual bool clipPath(const SkPath& path,
-                          SkRegion::Op op,
-                          bool doAA) SK_OVERRIDE {
-        return this->updateClipConservativelyUsingBounds(path.getBounds(), op,
-                                                         path.isInverseFillType());
+    virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
+        this->updateClipConservativelyUsingBounds(path.getBounds(), op,
+                                                  path.isInverseFillType());
     }
-    virtual bool clipRRect(const SkRRect& rrect,
-                           SkRegion::Op op,
-                           bool doAA) SK_OVERRIDE {
-        return this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false);
+    virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
+        this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false);
     }
 
 private:
diff --git a/src/utils/SkProxyCanvas.cpp b/src/utils/SkProxyCanvas.cpp
index 245e0a6..0a9d7a8 100644
--- a/src/utils/SkProxyCanvas.cpp
+++ b/src/utils/SkProxyCanvas.cpp
@@ -58,20 +58,20 @@
     fProxy->setMatrix(matrix);
 }
 
-bool SkProxyCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
-    return fProxy->clipRect(rect, op, doAA);
+void SkProxyCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+    fProxy->clipRect(rect, op, kSoft_ClipEdgeStyle == edgeStyle);
 }
 
-bool SkProxyCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
-    return fProxy->clipRRect(rrect, op, doAA);
+void SkProxyCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+    fProxy->clipRRect(rrect, op, kSoft_ClipEdgeStyle == edgeStyle);
 }
 
-bool SkProxyCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
-    return fProxy->clipPath(path, op, doAA);
+void SkProxyCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+    fProxy->clipPath(path, op, kSoft_ClipEdgeStyle == edgeStyle);
 }
 
-bool SkProxyCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
-    return fProxy->clipRegion(deviceRgn, op);
+void SkProxyCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
+    fProxy->clipRegion(deviceRgn, op);
 }
 
 void SkProxyCanvas::drawPaint(const SkPaint& paint) {
diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp
index 15165c2..fedef69 100644
--- a/src/utils/debugger/SkDebugCanvas.cpp
+++ b/src/utils/debugger/SkDebugCanvas.cpp
@@ -43,7 +43,8 @@
     large.roundOut(&largeIRect);
     SkASSERT(!largeIRect.isEmpty());
 #endif
-    INHERITED::clipRect(large, SkRegion::kReplace_Op, false);
+    // call the base class' version to avoid adding a draw command
+    this->INHERITED::onClipRect(large, SkRegion::kReplace_Op, kHard_ClipEdgeStyle);
 }
 
 SkDebugCanvas::~SkDebugCanvas() {
@@ -297,24 +298,20 @@
     addDrawCommand(new SkClearCommand(color));
 }
 
-bool SkDebugCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
-    addDrawCommand(new SkClipPathCommand(path, op, doAA));
-    return true;
+void SkDebugCanvas::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+    this->addDrawCommand(new SkClipPathCommand(path, op, kSoft_ClipEdgeStyle == edgeStyle));
 }
 
-bool SkDebugCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
-    addDrawCommand(new SkClipRectCommand(rect, op, doAA));
-    return true;
+void SkDebugCanvas::onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+    this->addDrawCommand(new SkClipRectCommand(rect, op, kSoft_ClipEdgeStyle == edgeStyle));
 }
 
-bool SkDebugCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
-    addDrawCommand(new SkClipRRectCommand(rrect, op, doAA));
-    return true;
+void SkDebugCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
+    this->addDrawCommand(new SkClipRRectCommand(rrect, op, kSoft_ClipEdgeStyle == edgeStyle));
 }
 
-bool SkDebugCanvas::clipRegion(const SkRegion& region, SkRegion::Op op) {
-    addDrawCommand(new SkClipRegionCommand(region, op));
-    return true;
+void SkDebugCanvas::onClipRegion(const SkRegion& region, SkRegion::Op op) {
+    this->addDrawCommand(new SkClipRegionCommand(region, op));
 }
 
 bool SkDebugCanvas::concat(const SkMatrix& matrix) {
diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h
index 7d49627..ebce6c9 100644
--- a/src/utils/debugger/SkDebugCanvas.h
+++ b/src/utils/debugger/SkDebugCanvas.h
@@ -143,16 +143,6 @@
 
     virtual void clear(SkColor) SK_OVERRIDE;
 
-    virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
-
-    virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
-
-    virtual bool clipRRect(const SkRRect& rrect,
-                           SkRegion::Op op = SkRegion::kIntersect_Op,
-                           bool doAntiAlias = false) SK_OVERRIDE;
-
-    virtual bool clipRegion(const SkRegion& region, SkRegion::Op op) SK_OVERRIDE;
-
     virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
 
     virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top,
@@ -233,11 +223,35 @@
     static const int kVizImageHeight = 256;
     static const int kVizImageWidth = 256;
 
+    virtual bool isClipEmpty() const SK_OVERRIDE { return false; }
+    virtual ClipType getClipType() const SK_OVERRIDE { 
+        return kRect_ClipType; 
+    }
+    virtual bool getClipBounds(SkRect* bounds) const SK_OVERRIDE {
+        if (NULL != bounds) {
+            bounds->setXYWH(0, 0, 
+                            SkIntToScalar(this->imageInfo().fWidth), 
+                            SkIntToScalar(this->imageInfo().fHeight));
+        }
+        return true;
+    }
+    virtual bool getClipDeviceBounds(SkIRect* bounds) const SK_OVERRIDE {
+        if (NULL != bounds) {
+            bounds->setLargest();
+        }
+        return true;
+    }
+
 protected:
     virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
     virtual void onPushCull(const SkRect& cullRect) SK_OVERRIDE;
     virtual void onPopCull() SK_OVERRIDE;
 
+    virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE;
+    virtual void onClipRegion(const SkRegion& region, SkRegion::Op) SK_OVERRIDE;
+
 private:
     SkTDArray<SkDrawCommand*> fCommandVector;
     int fWidth;