Make fewer copies when using GrDrawTarget::AutoStateRestore
Review URL: http://codereview.appspot.com/5938043/
git-svn-id: http://skia.googlecode.com/svn/trunk@3557 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 6863630..aeb104c 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -544,7 +544,7 @@
GrIRect clipRect;
GrDrawState* drawState = this->drawState();
- const GrRenderTarget* rt = drawState->getRenderTarget();
+ GrRenderTarget* rt = drawState->getRenderTarget();
// GrDrawTarget should have filtered this for us
GrAssert(NULL != rt);
@@ -592,16 +592,16 @@
const GrClip& clip = stencilBuffer->getLastClip();
fClip.setFromRect(bounds);
- AutoStateRestore asr(this);
+ AutoStateRestore asr(this, GrDrawTarget::kReset_ASRInit);
+ drawState = this->drawState();
+ drawState->setRenderTarget(rt);
AutoGeometryPush agp(this);
- drawState->viewMatrix()->reset();
this->flushScissor(NULL);
#if !VISUALIZE_COMPLEX_CLIP
drawState->enableState(GrDrawState::kNoColorWrites_StateBit);
-#else
- drawState->disableState(GrDrawState::kNoColorWrites_StateBit);
#endif
+
int count = clip.getElementCount();
int clipBit = stencilBuffer->bits();
SkASSERT((clipBit <= 16) &&