Resubmit r7899 and r7901.


git-svn-id: http://skia.googlecode.com/svn/trunk@7929 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index e599fc9..e77bf93 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -92,8 +92,6 @@
 
     fVertices = NULL;
     fMaxVertices = 0;
-
-    fVertexLayout =  GrDrawState::StageTexCoordVertexLayoutBit(kGlyphMaskStage);
 }
 
 GrTextContext::~GrTextContext() {
@@ -189,13 +187,20 @@
     }
 
     if (NULL == fVertices) {
-        // If we need to reserve vertices allow the draw target to suggest
+        // position + texture coord
+        static const GrVertexAttrib kVertexAttribs[] = {
+            GrVertexAttrib(kVec2f_GrVertexAttribType, 0),
+            GrVertexAttrib(kVec2f_GrVertexAttribType, sizeof(GrPoint))
+        };
+        static const GrAttribBindings kAttribBindings = GrDrawState::ExplicitTexCoordAttribBindingsBit(kGlyphMaskStage);
+
+       // If we need to reserve vertices allow the draw target to suggest
         // a number of verts to reserve and whether to perform a flush.
         fMaxVertices = kMinRequestedVerts;
         bool flush = false;
         fDrawTarget = fContext->getTextTarget(fPaint);
         if (NULL != fDrawTarget) {
-            fDrawTarget->drawState()->setVertexLayout(fVertexLayout);
+            fDrawTarget->drawState()->setVertexAttribs(kVertexAttribs, SK_ARRAY_COUNT(kVertexAttribs));
             flush = fDrawTarget->geometryHints(&fMaxVertices, NULL);
         }
         if (flush) {
@@ -203,8 +208,11 @@
             fContext->flush();
             // flushGlyphs() will reset fDrawTarget to NULL.
             fDrawTarget = fContext->getTextTarget(fPaint);
-            fDrawTarget->drawState()->setVertexLayout(fVertexLayout);
+            fDrawTarget->drawState()->setVertexAttribs(kVertexAttribs, SK_ARRAY_COUNT(kVertexAttribs));
         }
+        fDrawTarget->drawState()->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0);
+        fDrawTarget->drawState()->setAttribIndex(GrDrawState::kTexCoord_AttribIndex, 1);
+        fDrawTarget->drawState()->setAttribBindings(kAttribBindings);
         fMaxVertices = kDefaultRequestedVerts;
         // ignore return, no point in flushing again.
         fDrawTarget->geometryHints(&fMaxVertices, NULL);
@@ -222,6 +230,7 @@
                                                    GrTCast<void**>(&fVertices),
                                                    NULL);
         GrAlwaysAssert(success);
+        GrAssert(2*sizeof(GrPoint) == fDrawTarget->getDrawState().getVertexSize());
     }
 
     GrFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX);