First pass at accelerating gpu-based AA clipping

http://codereview.appspot.com/6195051/



git-svn-id: http://skia.googlecode.com/svn/trunk@3853 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h
index 516ec95..f827948 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -14,6 +14,7 @@
 #include "GrNoncopyable.h"
 #include "GrClip.h"
 #include "SkRefCnt.h"
+#include "GrTexture.h"
 
 class GrGpu;
 class GrPathRenderer;
@@ -41,9 +42,15 @@
  */
 class GrClipMaskCache : public GrNoncopyable {
 public:
-    GrClipMaskCache() 
-    : fLastWidth(-1)
-    , fLastHeight(-1) {
+    GrClipMaskCache() {
+        reset();
+    }
+
+    void reset () {
+        fLastWidth = -1;
+        fLastHeight = -1;
+        fLastClip.setEmpty();
+        fLastMask.reset(NULL);
         fLastBound.MakeEmpty();
     }
 
@@ -68,10 +75,42 @@
         fLastBound = bound;
     }
 
-    GrTexture*  getLastMask() {
+    int getLastWidth() const {
+        return fLastWidth;
+    }
+
+    int getLastHeight() const {
+        return fLastHeight;
+    }
+
+    const GrClip& getLastClip() const {
+        return fLastClip;
+    }
+
+    GrTexture* getLastMask() {
         return fLastMask.get();
     }
 
+    GrTexture* detachLastMask() {
+        return fLastMask.detach();
+    }
+
+    int getLastMaskWidth() const {
+        if (NULL == fLastMask.get()) {
+            return -1;
+        }
+
+        return fLastMask.get()->width();
+    }
+
+    int getLastMaskHeight() const {
+        if (NULL == fLastMask.get()) {
+            return -1;
+        }
+
+        return fLastMask.get()->height();
+    }
+
     const GrRect& getLastBound() const {
         return fLastBound;
     }
@@ -150,6 +189,10 @@
                      const GrRect& rect,
                      GrTexture* texture);
 
+    void getAccum(GrGpu* gpu,
+                  const GrTextureDesc& desc,
+                  GrTexture** accum);
+
     // determines the path renderer used to draw a clip path element.
     GrPathRenderer* getClipPathRenderer(GrGpu* gpu,
                                         const SkPath& path,