Move vertex layout from GeometrySrcState to GrDrawState.
Also adds AutoStateRestore member to AutoGeometryPush to push DrawState as well
as GeometrySrcState. And removed vertex layout as an argument to a number of
functions -- they will get vertex layout info from the current DrawState.
Review URL: https://codereview.appspot.com/7286047
git-svn-id: http://skia.googlecode.com/svn/trunk@7600 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 97e92fa..2a26dae 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -203,19 +203,19 @@
// 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 = (NULL != fDrawTarget) &&
- fDrawTarget->geometryHints(GrDrawState::VertexSize(fVertexLayout),
- &fMaxVertices,
- NULL);
+ bool flush = false;
+ fDrawTarget = fContext->getTextTarget(fPaint);
+ if (NULL != fDrawTarget) {
+ fDrawTarget->drawState()->setVertexLayout(fVertexLayout);
+ flush = fDrawTarget->geometryHints(&fMaxVertices, NULL);
+ }
if (flush) {
this->flushGlyphs();
fContext->flush();
}
- fDrawTarget = fContext->getTextTarget(fPaint);
fMaxVertices = kDefaultRequestedVerts;
// ignore return, no point in flushing again.
- fDrawTarget->geometryHints(GrDrawState::VertexSize(fVertexLayout),
- &fMaxVertices,
+ fDrawTarget->geometryHints(&fMaxVertices,
NULL);
int maxQuadVertices = 4 * fContext->getQuadIndexBuffer()->maxQuads();
@@ -226,7 +226,6 @@
fMaxVertices = maxQuadVertices;
}
bool success = fDrawTarget->reserveVertexAndIndexSpace(
- fVertexLayout,
fMaxVertices,
0,
GrTCast<void**>(&fVertices),