Make clear a GrDrawTarget virtual method and implement in GrInOrderDrawBuffer

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



git-svn-id: http://skia.googlecode.com/svn/trunk@1176 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrInOrderDrawBuffer.h b/gpu/include/GrInOrderDrawBuffer.h
index c80afd9..03a2f2d 100644
--- a/gpu/include/GrInOrderDrawBuffer.h
+++ b/gpu/include/GrInOrderDrawBuffer.h
@@ -100,6 +100,8 @@
                                int* vertexCount,
                                int* indexCount) const;
 
+    virtual void clear(GrColor color);
+
 private:
 
     struct Draw {
@@ -115,6 +117,11 @@
         const GrIndexBuffer*    fIndexBuffer;
     };
 
+    struct Clear {
+        int fBeforeDrawIdx;
+        GrColor fColor;
+    };
+
     virtual bool onAcquireGeometry(GrVertexLayout vertexLayout,
                                    void**         vertices,
                                    void**         indices);
@@ -135,6 +142,7 @@
 
     GrTAllocator<Draw>              fDraws;
     GrTAllocator<SavedDrawState>    fStates;
+    GrTAllocator<Clear>             fClears;
 
     GrTAllocator<GrClip>            fClips;
     bool                            fClipSet;
@@ -163,11 +171,13 @@
         kDrawPreallocCnt   = 8,
         kStatePreallocCnt  = 8,
         kClipPreallocCnt   = 8,
+        kClearPreallocCnt  = 4,
     };
 
     GrAlignedSTStorage<kDrawPreallocCnt, Draw>              fDrawStorage;
     GrAlignedSTStorage<kStatePreallocCnt, SavedDrawState>   fStateStorage;
     GrAlignedSTStorage<kClipPreallocCnt, GrClip>            fClipStorage;
+    GrAlignedSTStorage<kClearPreallocCnt, Clear>            fClearStorage;
 
     typedef GrDrawTarget INHERITED;
 };