Revert r7901 & r7899 to allow DEPS roll
git-svn-id: http://skia.googlecode.com/svn/trunk@7909 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index e77bf93..e599fc9 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -92,6 +92,8 @@
fVertices = NULL;
fMaxVertices = 0;
+
+ fVertexLayout = GrDrawState::StageTexCoordVertexLayoutBit(kGlyphMaskStage);
}
GrTextContext::~GrTextContext() {
@@ -187,20 +189,13 @@
}
if (NULL == fVertices) {
- // 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
+ // 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()->setVertexLayout(fVertexLayout);
flush = fDrawTarget->geometryHints(&fMaxVertices, NULL);
}
if (flush) {
@@ -208,11 +203,8 @@
fContext->flush();
// flushGlyphs() will reset fDrawTarget to NULL.
fDrawTarget = fContext->getTextTarget(fPaint);
- fDrawTarget->drawState()->setVertexAttribs(kVertexAttribs, SK_ARRAY_COUNT(kVertexAttribs));
+ fDrawTarget->drawState()->setVertexLayout(fVertexLayout);
}
- 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);
@@ -230,7 +222,6 @@
GrTCast<void**>(&fVertices),
NULL);
GrAlwaysAssert(success);
- GrAssert(2*sizeof(GrPoint) == fDrawTarget->getDrawState().getVertexSize());
}
GrFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX);