Make flush discardable and lazily reset context

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



git-svn-id: http://skia.googlecode.com/svn/trunk@914 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrGpuGLFixed.cpp b/gpu/src/GrGpuGLFixed.cpp
index 516381e..695b22c 100644
--- a/gpu/src/GrGpuGLFixed.cpp
+++ b/gpu/src/GrGpuGLFixed.cpp
@@ -58,7 +58,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 GrGpuGLFixed::GrGpuGLFixed() {
-    resetContextHelper();
 }
 
 GrGpuGLFixed::~GrGpuGLFixed() {
@@ -66,10 +65,7 @@
 
 void GrGpuGLFixed::resetContext() {
     INHERITED::resetContext();
-    resetContextHelper();
-}
 
-void GrGpuGLFixed::resetContextHelper() {
     GR_GL(Disable(GL_TEXTURE_2D));
 
     for (int s = 0; s < kNumStages; ++s) {
@@ -204,11 +200,11 @@
                 }
 
                 if (((1 << s) & fDirtyFlags.fTextureChangedMask) ||
-                    (fHWDrawState.fSamplerStates[s].getMatrix() != 
+                    (fHWDrawState.fSamplerStates[s].getMatrix() !=
                      getSamplerMatrix(s))) {
 
                     GrMatrix texMat = getSamplerMatrix(s);
-                    AdjustTextureMatrix(texture, 
+                    AdjustTextureMatrix(texture,
                                         GrSamplerState::kNormal_SampleMode,
                                         &texMat);
                     GrGpuMatrix glm;