Un-trifurcate GrTextContext: get rid of Default and Batched subclasses,
folding their functionality back into the base class.

Requires gyp changes.

http://codereview.appspot.com/6357048/



git-svn-id: http://skia.googlecode.com/svn/trunk@4411 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index c6f377d..c3e495a 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2011 Google Inc.
  *
@@ -11,7 +10,6 @@
 #include "effects/GrGradientEffects.h"
 
 #include "GrContext.h"
-#include "GrDefaultTextContext.h"
 #include "GrTextContext.h"
 
 #include "SkGrTexturePixelRef.h"
@@ -23,8 +21,6 @@
 #include "SkTLazy.h"
 #include "SkUtils.h"
 
-SK_DEFINE_INST_COUNT(GrTextContext)
-
 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1
 
 #if 0
@@ -203,8 +199,6 @@
         pr = new SkGrRenderTargetPixelRef(fRenderTarget);
     }
     this->setPixelRef(pr, 0)->unref();
-
-    fTextContext = NULL;
 }
 
 SkGpuDevice::SkGpuDevice(GrContext* context,
@@ -250,8 +244,6 @@
                  width, height);
         GrAssert(false);
     }
-
-    fTextContext = NULL;
 }
 
 SkGpuDevice::~SkGpuDevice() {
@@ -271,10 +263,6 @@
         fContext->unlockTexture(fCache);
     }
     fContext->unref();
-
-    if (NULL != fTextContext) {
-        fTextContext->unref();
-    }
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1745,9 +1733,8 @@
                                    &grPaint)) {
             return;
         }
-        GrTextContext::AutoFinish txtCtxAF(this->getTextContext(), fContext,
-                                           grPaint, draw.fExtMatrix);
-        myDraw.fProcs = this->initDrawForText(txtCtxAF.getTextContext());
+        GrTextContext context(fContext, grPaint, draw.fExtMatrix);
+        myDraw.fProcs = this->initDrawForText(&context);
         this->INHERITED::drawText(myDraw, text, byteLength, x, y, paint);
     }
 }
@@ -1774,9 +1761,8 @@
                                    &grPaint)) {
             return;
         }
-        GrTextContext::AutoFinish txtCtxAF(this->getTextContext(), fContext,
-                                           grPaint, draw.fExtMatrix);
-        myDraw.fProcs = this->initDrawForText(txtCtxAF.getTextContext());
+        GrTextContext context(fContext, grPaint, draw.fExtMatrix);
+        myDraw.fProcs = this->initDrawForText(&context);
         this->INHERITED::drawPosText(myDraw, text, byteLength, pos, constY,
                                      scalarsPerPos, paint);
     }
@@ -1927,9 +1913,3 @@
     fNeedClear = needClear;
 }
 
-GrTextContext* SkGpuDevice::getTextContext() {
-    if (NULL == fTextContext) {
-        fTextContext = new GrDefaultTextContext();
-    }
-    return fTextContext;
-}