Index: src/gpu/GrTextContext.cpp |
=================================================================== |
--- src/gpu/GrTextContext.cpp (revision 8777) |
+++ src/gpu/GrTextContext.cpp (working copy) |
@@ -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. |