Add support for clipstack to Gr. GrClip is now a list of rects and paths with set operations to combine them. The stencil buffer is used to perform the set operations to put the clip into the stencil buffer. Building Gr's clip from Skia's clipStack is currently disabled due to the fact that Skia's clipStack is relative to the root layer not the current layer. This will be fixed in a subsequent CL.

git-svn-id: http://skia.googlecode.com/svn/trunk@878 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrTexture.h b/gpu/include/GrTexture.h
index 098ac59..2d3928c 100644
--- a/gpu/include/GrTexture.h
+++ b/gpu/include/GrTexture.h
@@ -19,6 +19,7 @@
 #define GrTexture_DEFINED
 
 #include "GrRefCnt.h"
+#include "GrClip.h"
 
 class GrTexture;
 
@@ -34,11 +35,16 @@
     /**
      * @return the width of the rendertarget
      */
-    virtual int width() const = 0;
+    int width() const { return fWidth; }
     /**
      * @return the height of the rendertarget
      */
-    virtual int height() const = 0;
+    int height() const { return fHeight; }
+
+    /**
+     * @return the number of stencil bits in the rendertarget
+     */
+    int stencilBits() const { return fStencilBits; }
 
     /**
      * @return the texture associated with the rendertarget, may be NULL.
@@ -46,8 +52,28 @@
     GrTexture* asTexture() {return fTexture;}
 
 protected:
-    GrRenderTarget(GrTexture* texture) : fTexture(texture) {}
+    GrRenderTarget(GrTexture* texture,
+                   int width,
+                   int height,
+                   int stencilBits)
+        : fTexture(texture),
+          fWidth(width),
+          fHeight(height),
+          fStencilBits(stencilBits) {}
+
+
     GrTexture* fTexture;
+    int        fWidth;
+    int        fHeight;
+    int        fStencilBits;
+
+private:
+    // GrGpu keeps a cached clip in the render target to avoid redundantly
+    // rendering the clip into the same stencil buffer.
+    friend class GrGpu;
+    GrClip     fLastStencilClip;
+
+    typedef GrRefCnt INHERITED;
 };
 
 class GrTexture : public GrRefCnt {