Fixed bug(s) in batching of rects

https://codereview.appspot.com/6608043/



git-svn-id: http://skia.googlecode.com/svn/trunk@5811 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 560c1a7..26bef45 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -569,7 +569,12 @@
 
 void GrContext::setClip(const GrClipData* clipData) {
     fGpu->setClip(clipData);
-    fDrawState->enableState(GrDrawState::kClip_StateBit);
+
+    if (clipData->fClipStack->isWideOpen()) {
+        fDrawState->disableState(GrDrawState::kClip_StateBit);
+    } else {
+        fDrawState->enableState(GrDrawState::kClip_StateBit);
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index e043926..c69675f 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -190,7 +190,7 @@
             GeometryPoolState& poolState = fGeoPoolStateStack.back();
 
             appendToPreviousDraw =
-                kDraw_Cmd != fCmds.back() &&
+                kDraw_Cmd == fCmds.back() &&
                 lastDraw.fVertexBuffer == poolState.fPoolVertexBuffer &&
                 (fCurrQuad * 4 + lastDraw.fStartVertex) == poolState.fPoolStartVertex;