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/GrContext.cpp b/gpu/src/GrContext.cpp
index a047895..c6fa618 100644
--- a/gpu/src/GrContext.cpp
+++ b/gpu/src/GrContext.cpp
@@ -560,9 +560,14 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 
-void GrContext::flush(bool flushRenderTarget) {
-    flushDrawBuffer();
-    if (flushRenderTarget) {
+void GrContext::flush(int flagsBitfield) {
+    if (kDiscard_FlushBit & flagsBitfield) {
+        fDrawBuffer->reset();
+    } else {
+        flushDrawBuffer();
+    }
+
+    if (kForceCurrentRenderTarget_FlushBit & flagsBitfield) {
         fGpu->forceRenderTargetFlush();
     }
 }
@@ -683,7 +688,7 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 void GrContext::resetContext() {
-    fGpu->resetContext();
+    fGpu->markContextDirty();
 }
 
 void GrContext::setRenderTarget(GrRenderTarget* target) {