Combine clip stack and clip origin into one struct in GrIODB.

R=egdaniel@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/364823004
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 45c3884..1cd7f53 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -548,7 +548,6 @@
     fVertexPool.reset();
     fIndexPool.reset();
     fClips.reset();
-    fClipOrigins.reset();
     fCopySurfaces.reset();
     fGpuCmdMarkers.reset();
     fClipSet = true;
@@ -587,7 +586,6 @@
 
     StateAllocator::Iter stateIter(&fStates);
     ClipAllocator::Iter clipIter(&fClips);
-    ClipOriginAllocator::Iter clipOriginIter(&fClipOrigins);
     ClearAllocator::Iter clearIter(&fClears);
     DrawAllocator::Iter drawIter(&fDraws);
     StencilPathAllocator::Iter stencilPathIter(&fStencilPaths);
@@ -644,9 +642,8 @@
                 break;
             case kSetClip_Cmd:
                 SkAssertResult(clipIter.next());
-                SkAssertResult(clipOriginIter.next());
-                clipData.fClipStack = clipIter.get();
-                clipData.fOrigin = *clipOriginIter;
+                clipData.fClipStack = &clipIter->fStack;
+                clipData.fOrigin = clipIter->fOrigin;
                 fDstGpu->setClip(&clipData);
                 break;
             case kClear_Cmd:
@@ -676,7 +673,6 @@
     // we should have consumed all the states, clips, etc.
     SkASSERT(!stateIter.next());
     SkASSERT(!clipIter.next());
-    SkASSERT(!clipOriginIter.next());
     SkASSERT(!clearIter.next());
     SkASSERT(!drawIter.next());
     SkASSERT(!copySurfaceIter.next());
@@ -928,12 +924,11 @@
 }
 
 bool GrInOrderDrawBuffer::needsNewClip() const {
-    SkASSERT(fClips.count() == fClipOrigins.count());
     if (this->getDrawState().isClipState()) {
        if (fClipSet &&
            (fClips.empty() ||
-            fClips.back() != *this->getClip()->fClipStack ||
-            fClipOrigins.back() != this->getClip()->fOrigin)) {
+            fClips.back().fStack != *this->getClip()->fClipStack ||
+            fClips.back().fOrigin != this->getClip()->fOrigin)) {
            return true;
        }
     }
@@ -952,8 +947,8 @@
 }
 
 void GrInOrderDrawBuffer::recordClip() {
-    fClips.push_back(*this->getClip()->fClipStack);
-    fClipOrigins.push_back() = this->getClip()->fOrigin;
+    fClips.push_back().fStack = *this->getClip()->fClipStack;
+    fClips.back().fOrigin = this->getClip()->fOrigin;
     fClipSet = false;
     this->addToCmdBuffer(kSetClip_Cmd);
 }
@@ -993,7 +988,6 @@
     return &fCopySurfaces.push_back();
 }
 
-
 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) {
     INHERITED::clipWillBeSet(newClipData);
     fClipSet = true;
diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h
index fd06014..b31a995 100644
--- a/src/gpu/GrInOrderDrawBuffer.h
+++ b/src/gpu/GrInOrderDrawBuffer.h
@@ -145,6 +145,11 @@
         SkIPoint                fDstPoint;
     };
 
+    struct Clip : public ::SkNoncopyable {
+        SkClipStack fStack;
+        SkIPoint    fOrigin;
+    };
+
     // overrides from GrDrawTarget
     virtual void onDraw(const DrawInfo&) SK_OVERRIDE;
     virtual void onDrawRect(const SkRect& rect,
@@ -230,8 +235,7 @@
     typedef GrTAllocator<GrDrawState::DeferredState>        StateAllocator;
     typedef GrTAllocator<Clear>                             ClearAllocator;
     typedef GrTAllocator<CopySurface>                       CopySurfaceAllocator;
-    typedef GrTAllocator<SkClipStack>                       ClipAllocator;
-    typedef GrTAllocator<SkIPoint>                          ClipOriginAllocator;
+    typedef GrTAllocator<Clip>                              ClipAllocator;
 
     GrSTAllocator<kDrawPreallocCnt, DrawRecord>                        fDraws;
     GrSTAllocator<kStencilPathPreallocCnt, StencilPath>                fStencilPaths;
@@ -240,8 +244,7 @@
     GrSTAllocator<kStatePreallocCnt, GrDrawState::DeferredState>       fStates;
     GrSTAllocator<kClearPreallocCnt, Clear>                            fClears;
     GrSTAllocator<kCopySurfacePreallocCnt, CopySurface>                fCopySurfaces;
-    GrSTAllocator<kClipPreallocCnt, SkClipStack>                       fClips;
-    GrSTAllocator<kClipPreallocCnt, SkIPoint>                          fClipOrigins;
+    GrSTAllocator<kClipPreallocCnt, Clip>                              fClips;
 
     SkTArray<GrTraceMarkerSet, false>                                  fGpuCmdMarkers;