change virtual setMatrixClip() to take a SkClipStack parameter.



git-svn-id: http://skia.googlecode.com/svn/trunk@831 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index a1e6a64..a790399 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -23,6 +23,7 @@
 #include "SkColor.h"
 #include "SkRefDict.h"
 
+class SkClipStack;
 class SkDevice;
 class SkDraw;
 struct SkIRect;
@@ -122,11 +123,20 @@
      */
     virtual SkGpuTexture* accessTexture() { return NULL; }
 
-    /** Called with the correct matrix and clip before this device is drawn
-        to using those settings. If your subclass overrides this, be sure to
-        call through to the base class as well.
+    /**
+     *  Called with the correct matrix and clip before this device is drawn
+     *  to using those settings. If your subclass overrides this, be sure to
+     *  call through to the base class as well.
+     *
+     *  The clipstack is another view of the clip. It records the actual
+     *  geometry that went into building the region. It is present for devices
+     *  that want to parse it, but is not required: the region is a complete
+     *  picture of the current clip. (i.e. if you regionize all of the geometry
+     *  in the clipstack, you will arrive at an equivalent region to the one
+     *  passed in).
     */
-    virtual void setMatrixClip(const SkMatrix&, const SkRegion&);
+    virtual void setMatrixClip(const SkMatrix&, const SkRegion&,
+                               const SkClipStack&);
 
     /** Called when this device gains focus (i.e becomes the current device
         for drawing).
diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h
index db65e05..2db3380 100644
--- a/include/gpu/SkGpuDevice.h
+++ b/include/gpu/SkGpuDevice.h
@@ -77,7 +77,8 @@
     virtual bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap);
     virtual void writePixels(const SkBitmap& bitmap, int x, int y);
 
-    virtual void setMatrixClip(const SkMatrix& matrix, const SkRegion& clip);
+    virtual void setMatrixClip(const SkMatrix& matrix, const SkRegion& clip,
+                               const SkClipStack&);
 
     virtual void drawPaint(const SkDraw&, const SkPaint& paint);
     virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t count,
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index b6bc7be..5bcc8e3 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -64,7 +64,8 @@
         to using those settings. If your subclass overrides this, be sure to
         call through to the base class as well.
     */
-    virtual void setMatrixClip(const SkMatrix&, const SkRegion&);
+    virtual void setMatrixClip(const SkMatrix&, const SkRegion&,
+                               const SkClipStack&);
 
     virtual bool readPixels(const SkIRect& srcRect, SkBitmap* bitmap) {
         return false;
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 88b012d..94db24c 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -99,7 +99,7 @@
 	}
 
     void updateMC(const SkMatrix& totalMatrix, const SkRegion& totalClip,
-                  SkRegion* updateClip) {
+                  const SkClipStack& clipStack, SkRegion* updateClip) {
         int x = fX;
         int y = fY;
         int width = fDevice->width();
@@ -126,7 +126,7 @@
                            SkRegion::kDifference_Op);
         }
 
-        fDevice->setMatrixClip(*fMatrix, fClip);
+        fDevice->setMatrixClip(*fMatrix, fClip, clipStack);
 
 #ifdef SK_DEBUG
         if (!fClip.isEmpty()) {
@@ -610,7 +610,7 @@
         DeviceCM*       layer = fMCRec->fTopLayer;
 
         if (NULL == layer->fNext) {   // only one layer
-            layer->updateMC(totalMatrix, totalClip, NULL);
+            layer->updateMC(totalMatrix, totalClip, fClipStack, NULL);
             if (fUseExternalMatrix) {
                 layer->updateExternalMatrix(fExternalMatrix,
                                             fExternalInverse);
@@ -619,7 +619,7 @@
             SkRegion clip;
             clip = totalClip;  // make a copy
             do {
-                layer->updateMC(totalMatrix, clip, &clip);
+                layer->updateMC(totalMatrix, clip, fClipStack, &clip);
                 if (fUseExternalMatrix) {
                     layer->updateExternalMatrix(fExternalMatrix,
                                                 fExternalInverse);
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 8df0e41..2383ed9 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -11,7 +11,7 @@
     // auto-allocate if we're for offscreen drawing
     if (isForLayer) {
         if (NULL == fBitmap.getPixels() && NULL == fBitmap.pixelRef()) {
-            fBitmap.allocPixels();   
+            fBitmap.allocPixels();
             if (!fBitmap.isOpaque()) {
                 fBitmap.eraseColor(0);
             }
@@ -43,7 +43,7 @@
 
 bool SkDevice::intersects(const SkIRect& r, SkIRect* sect) const {
     SkIRect bounds;
-    
+
     this->getBounds(&bounds);
     return sect ? sect->intersect(r, bounds) : SkIRect::Intersects(r, bounds);
 }
@@ -54,7 +54,8 @@
 
 void SkDevice::onAccessBitmap(SkBitmap* bitmap) {}
 
-void SkDevice::setMatrixClip(const SkMatrix&, const SkRegion&) {}
+void SkDevice::setMatrixClip(const SkMatrix&, const SkRegion&,
+                             const SkClipStack&) {}
 
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -116,7 +117,7 @@
                           const SkMatrix& matrix, const SkPaint& paint) {
     SkBitmap        tmp;    // storage if we need a subset of bitmap
     const SkBitmap* bitmapPtr = &bitmap;
-    
+
     if (srcRect) {
         if (!bitmap.extractSubset(&tmp, *srcRect)) {
             return;     // extraction failed
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 3bf157b..71c0c48 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -294,8 +294,9 @@
     }
 }
 
-void SkGpuDevice::setMatrixClip(const SkMatrix& matrix, const SkRegion& clip) {
-    this->INHERITED::setMatrixClip(matrix, clip);
+void SkGpuDevice::setMatrixClip(const SkMatrix& matrix, const SkRegion& clip,
+                                const SkClipStack& clipStack) {
+    this->INHERITED::setMatrixClip(matrix, clip, clipStack);
 
     convert_matrixclip(fContext, matrix, clip);
 }
@@ -912,7 +913,7 @@
     }
 
     grPaint->setTexture(texture);
-    
+
     GrRect dstRect(0, 0, GrIntToScalar(srcRect.width()), GrIntToScalar(srcRect.height()));
     GrRect paintRect;
     paintRect.setLTRB(GrFixedToScalar((srcRect.fLeft << 16)   / bitmap.width()),
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 8a74556..72b2e1b 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -152,7 +152,8 @@
 }
 
 void SkPDFDevice::setMatrixClip(const SkMatrix& matrix,
-                                const SkRegion& region) {
+                                const SkRegion& region,
+                                const SkClipStack&) {
     // See the comment in the header file above GraphicStackEntry.
     if (region != fGraphicStack[fGraphicStackIndex].fClip) {
         while (fGraphicStackIndex > 0)