aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-09-28 21:40:15 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-09-28 21:40:15 +0000
commit2e6020634a347626e111592b13ef5030d457bc3f (patch)
tree5d767ed863a3d2fec034171d0874801eaccf795f
parent768d59b97d9cdae1e66412b7fbe53c87c41a6cff (diff)
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
-rw-r--r--src/gpu/GrGpu.cpp13
1 files 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() {