From 2e6020634a347626e111592b13ef5030d457bc3f Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Fri, 28 Sep 2012 21:40:15 +0000 Subject: 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 --- src/gpu/GrGpu.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 514d176afc..4bc1574f3f 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -214,22 +214,15 @@ GrPath* GrGpu::createPath(const SkPath& path) { 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() { -- cgit v1.2.3