Add assert to catch circular drawing higher up the call stack.

git-svn-id: http://skia.googlecode.com/svn/trunk@3559 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2012-03-30 17:24:17 +00:00
parent 8a812c252d
commit b4725b4ee6
2 changed files with 9 additions and 0 deletions

View File

@ -94,6 +94,7 @@ public:
* render target
*/
GrRenderTarget* asRenderTarget() { return fRenderTarget; }
const GrRenderTarget* asRenderTarget() const { return fRenderTarget; }
/**
* Removes the reference on the associated GrRenderTarget held by this

View File

@ -771,6 +771,14 @@ bool GrDrawTarget::checkDraw(GrPrimitiveType type, int startVertex,
GrCrash("Index reads outside valid index range.");
}
}
GrAssert(NULL != this->getDrawState().getRenderTarget());
for (int i = 0; i < GrDrawState::kNumStages; ++i) {
if (this->getDrawState().getTexture(i)) {
GrAssert(this->getDrawState().getTexture(i)->asRenderTarget() !=
this->getDrawState().getRenderTarget());
}
}
#endif
const GrDrawState& drawState = this->getDrawState();
if (NULL == drawState.getRenderTarget()) {