Extend texture release on GrDrawState to also handle custom stages.
Add asserts to GrContext::setPaint() to make sure we're keeping things
cleaned up.
Remove double-call of setPaint() during text context initialization.
http://codereview.appspot.com/6324046/
git-svn-id: http://skia.googlecode.com/svn/trunk@4313 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrBatchedTextContext.cpp b/src/gpu/GrBatchedTextContext.cpp
index 9de2bad..666d894 100644
--- a/src/gpu/GrBatchedTextContext.cpp
+++ b/src/gpu/GrBatchedTextContext.cpp
@@ -26,7 +26,7 @@
const GrMatrix* extMatrix) {
this->INHERITED::init(context, grPaint, extMatrix);
fGrPaint = grPaint;
- fDrawTarget = fContext->getTextTarget(fGrPaint);
+ fDrawTarget = NULL;
fMaxVertices = 0;
fCurrTexture = NULL;
@@ -34,6 +34,10 @@
}
void GrBatchedTextContext::finish() {
+ GrAssert(fDrawTarget);
+ if (fDrawTarget) {
+ fDrawTarget->drawState()->disableStages();
+ }
fDrawTarget = NULL;
this->INHERITED::finish();
@@ -41,6 +45,7 @@
void GrBatchedTextContext::reset() {
GrAssert(this->isValid());
+ GrAssert(fDrawTarget);
fDrawTarget->resetVertexSource();
fMaxVertices = 0;
fCurrVertex = 0;
@@ -61,6 +66,7 @@
void GrBatchedTextContext::setupVertexBuff(void** vertexBuff,
GrVertexLayout vertexLayout) {
GrAssert(this->isValid());
+ GrAssert(fDrawTarget);
if (NULL == *vertexBuff) {
// If we need to reserve vertices allow the draw target to suggest
// a number of verts to reserve and whether to perform a flush.