Fix clear records in IODB
Review URL: http://codereview.appspot.com/6465061/
git-svn-id: http://skia.googlecode.com/svn/trunk@5148 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index a0585f7..e562300 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -467,20 +467,22 @@
GrColor color,
GrRenderTarget* renderTarget) {
GrIRect r;
+ if (NULL == renderTarget) {
+ renderTarget = this->drawState()->getRenderTarget();
+ GrAssert(NULL != renderTarget);
+ }
if (NULL == rect) {
// We could do something smart and remove previous draws and clears to
// the current render target. If we get that smart we have to make sure
// those draws aren't read before this clear (render-to-texture).
- r.setLTRB(0, 0,
- this->getDrawState().getRenderTarget()->width(),
- this->getDrawState().getRenderTarget()->height());
+ r.setLTRB(0, 0, renderTarget->width(), renderTarget->height());
rect = &r;
}
Clear* clr = this->recordClear();
clr->fColor = color;
clr->fRect = *rect;
clr->fRenderTarget = renderTarget;
- GrSafeRef(clr->fRenderTarget);
+ renderTarget->ref();
}
void GrInOrderDrawBuffer::reset() {