Remove unnecessary dirty clip flag in GrGpu, remove getUsableStencilBits()

Review URL: http://codereview.appspot.com/4828050/



git-svn-id: http://skia.googlecode.com/svn/trunk@2011 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrDrawTarget.h b/gpu/include/GrDrawTarget.h
index 177c363..4431dc0 100644
--- a/gpu/include/GrDrawTarget.h
+++ b/gpu/include/GrDrawTarget.h
@@ -100,23 +100,6 @@
     };
 
     /**
-     * The DrawTarget may reserve some of the high bits of the stencil. The draw
-     * target will automatically trim reference and mask values so that the
-     * client doesn't overwrite these bits.
-     * The number of bits available is relative to the currently set render
-      *target.
-     * @return the number of bits usable by the draw target client.
-     */
-    int getUsableStencilBits() const {
-        int bits = fCurrDrawState.fRenderTarget->stencilBits();
-        if (bits) {
-            return bits - 1;
-        } else {
-            return 0;
-        }
-    }
-
-    /**
      * Sets the stencil settings to use for the next draw.
      * Changing the clip has the side-effect of possibly zeroing
      * out the client settable stencil bits. So multipass algorithms
@@ -1234,9 +1217,9 @@
     virtual void onDrawNonIndexed(GrPrimitiveType type,
                                   int startVertex,
                                   int vertexCount) = 0;
-    // subclass overrides to be notified when clip is set.
-    virtual void clipWillBeSet(const GrClip& clip) = 0;
-
+    // subclass overrides to be notified when clip is set. Must call
+    // INHERITED::clipwillBeSet
+    virtual void clipWillBeSet(const GrClip& clip);
 
     // Helpers for drawRect, protected so subclasses that override drawRect
     // can use them.
diff --git a/gpu/include/GrGpu.h b/gpu/include/GrGpu.h
index 2ec10ae..ede6b3b 100644
--- a/gpu/include/GrGpu.h
+++ b/gpu/include/GrGpu.h
@@ -344,16 +344,9 @@
                                                  // clipping.
     };
 
-    /**
-     * Extensions to GrDrawTarget::StateBits to implement stencil clipping
-     */
-    struct ClipState {
-        bool            fClipInStencil;
-        bool            fClipIsDirty;
-    } fClipState;
-
-    // GrDrawTarget override
-    virtual void clipWillBeSet(const GrClip& newClip);
+    // keep track of whether we are using stencil clipping (as opposed to
+    // scissor).
+    bool    fClipInStencil;
 
     // prepares clip flushes gpu state before a draw
     bool setupClipAndFlushState(GrPrimitiveType type);
diff --git a/gpu/include/GrStencil.h b/gpu/include/GrStencil.h
index eb65eff..e0f6855 100644
--- a/gpu/include/GrStencil.h
+++ b/gpu/include/GrStencil.h
@@ -16,17 +16,15 @@
  * GrDrawTarget class. The GrDrawTarget makes a subset of the stencil buffer
  * bits available for other uses by external code (clients). Client code can
  * modify these bits. GrDrawTarget will ignore ref, mask, and writemask bits
- * provided by clients that overlap the bits used to implement clipping. The
- * client can use the getUsableStencilBits() function to find out how many
- * client accessible stencil bits are available.
+ * provided by clients that overlap the bits used to implement clipping.
  *
  * When code outside the GrDrawTarget class uses the stencil buffer the contract
  * is as follows:
  *
- * > Normal stencil funcs allow the GrGpu client to modify the client bits of
- *   the stencil buffer outside of the clip.
- * > Special functions allow a test against the clip. These are more limited
- *   than the general stencil functions.
+ * > Normal stencil funcs allow the client to pass / fail regardless of the
+ *   reserved clip bits.
+ * > Additional functions allow a test against the clip along with a limited
+ *   set of tests against the client bits.
  * > Client can assume all client bits are zero initially.
  * > Client must ensure that after all its passes are finished it has only
  *   written to the color buffer in the region inside the clip. Furthermore, it