Vertex Attrib configurations now handled as pointers vs. SkSTArrays

https://codereview.chromium.org/14328009/



git-svn-id: http://skia.googlecode.com/svn/trunk@8787 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 58b3e92..804165b 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -110,6 +110,16 @@
     this->flushGlyphs();
 }
 
+namespace {
+
+// position + texture coord
+extern const GrVertexAttrib gTextVertexAttribs[] = {
+    {kVec2f_GrVertexAttribType, 0,               kPosition_GrVertexAttribBinding},
+    {kVec2f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding}
+};
+
+};
+
 void GrTextContext::drawPackedGlyph(GrGlyph::PackedID packed,
                                     GrFixed vx, GrFixed vy,
                                     GrFontScaler* scaler) {
@@ -192,19 +202,13 @@
     }
 
     if (NULL == fVertices) {
-        // position + texture coord
-        static const GrVertexAttrib kVertexAttribs[] = {
-            {kVec2f_GrVertexAttribType, 0,               kPosition_GrVertexAttribBinding},
-            {kVec2f_GrVertexAttribType, sizeof(GrPoint), kEffect_GrVertexAttribBinding}
-        };
-
        // 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()->setVertexAttribs(kVertexAttribs, SK_ARRAY_COUNT(kVertexAttribs));
+            fDrawTarget->drawState()->setVertexAttribs<gTextVertexAttribs>(SK_ARRAY_COUNT(gTextVertexAttribs));
             flush = fDrawTarget->geometryHints(&fMaxVertices, NULL);
         }
         if (flush) {
@@ -212,7 +216,7 @@
             fContext->flush();
             // flushGlyphs() will reset fDrawTarget to NULL.
             fDrawTarget = fContext->getTextTarget(fPaint);
-            fDrawTarget->drawState()->setVertexAttribs(kVertexAttribs, SK_ARRAY_COUNT(kVertexAttribs));
+            fDrawTarget->drawState()->setVertexAttribs<gTextVertexAttribs>(SK_ARRAY_COUNT(gTextVertexAttribs));
         }
         fMaxVertices = kDefaultRequestedVerts;
         // ignore return, no point in flushing again.