Fix clear records in IODB
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 17 Aug 2012 13:43:08 +0000 (13:43 +0000)
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Fri, 17 Aug 2012 13:43:08 +0000 (13:43 +0000)
Review URL: http://codereview.appspot.com/6465061/

git-svn-id: http://skia.googlecode.com/svn/trunk@5148 2bbb7eff-a529-9590-31e7-b0007b416f81

src/gpu/GrInOrderDrawBuffer.cpp

index a0585f7..e562300 100644 (file)
@@ -467,20 +467,22 @@ void GrInOrderDrawBuffer::clear(const GrIRect* rect,
                                 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() {