Don't allow previous render target to be deleted in GrGpu::clear

R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6584043

git-svn-id: http://skia.googlecode.com/svn/trunk@5734 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 514d176..4bc1574 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -214,22 +214,15 @@
 void GrGpu::clear(const GrIRect* rect,
                   GrColor color,
                   GrRenderTarget* renderTarget) {
-    GrRenderTarget* oldRT = NULL;
-    if (NULL != renderTarget &&
-        renderTarget != this->drawState()->getRenderTarget()) {
-        oldRT = this->drawState()->getRenderTarget();
-        this->drawState()->setRenderTarget(renderTarget);
+    GrDrawState::AutoRenderTargetRestore art;
+    if (NULL != renderTarget) {
+        art.set(this->drawState(), renderTarget);
     }
-
     if (NULL == this->getDrawState().getRenderTarget()) {
         return;
     }
     this->handleDirtyContext();
     this->onClear(rect, color);
-
-    if (NULL != oldRT) {
-        this->drawState()->setRenderTarget(oldRT);
-    }
 }
 
 void GrGpu::forceRenderTargetFlush() {