Break up GrGpuGL::flushGLCommonState

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



git-svn-id: http://skia.googlecode.com/svn/trunk@4144 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 42043f9..379d40d 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -2182,16 +2182,11 @@
                                     this->getResetTimestamp());
 }
 
-bool GrGpuGL::flushGLStateCommon(GrPrimitiveType type) {
+void GrGpuGL::flushMiscFixedFunctionState() {
 
-    GrDrawState* drawState = this->drawState();
-    // GrGpu::setupClipAndFlushState should have already checked this
-    // and bailed if not true.
-    GrAssert(NULL != drawState->getRenderTarget());
+    const GrDrawState& drawState = this->getDrawState();
 
-    this->flushAAState(type);
-
-    if (drawState->isDitherState()) {
+    if (drawState.isDitherState()) {
         if (kYes_TriState != fHWDitherEnabled) {
             GL_CALL(Enable(GR_GL_DITHER));
             fHWDitherEnabled = kYes_TriState;
@@ -2203,7 +2198,7 @@
         }
     }
 
-    if (drawState->isColorWriteDisabled()) {
+    if (drawState.isColorWriteDisabled()) {
         if (kNo_TriState != fHWWriteToColor) {
             GL_CALL(ColorMask(GR_GL_FALSE, GR_GL_FALSE,
                               GR_GL_FALSE, GR_GL_FALSE));
@@ -2216,7 +2211,7 @@
         }
     }
 
-    if (fHWDrawFace != drawState->getDrawFace()) {
+    if (fHWDrawFace != drawState.getDrawFace()) {
         switch (this->getDrawState().getDrawFace()) {
             case GrDrawState::kCCW_DrawFace:
                 GL_CALL(Enable(GR_GL_CULL_FACE));
@@ -2232,23 +2227,8 @@
             default:
                 GrCrash("Unknown draw face.");
         }
-        fHWDrawFace = drawState->getDrawFace();
+        fHWDrawFace = drawState.getDrawFace();
     }
-
-#if GR_DEBUG
-    // check for circular rendering
-    for (int s = 0; s < GrDrawState::kNumStages; ++s) {
-        GrAssert(!this->isStageEnabled(s) ||
-                 NULL == drawState->getRenderTarget() ||
-                 NULL == drawState->getTexture(s) ||
-                 drawState->getTexture(s)->asRenderTarget() !=
-                    drawState->getRenderTarget());
-    }
-#endif
-
-    this->flushStencil();
-
-    return true;
 }
 
 void GrGpuGL::notifyVertexBufferBind(const GrGLVertexBuffer* buffer) {