Don't access RT when disabling scissor.
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/25446004
git-svn-id: http://skia.googlecode.com/svn/trunk/src@11608 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/gl/GrGpuGL.cpp b/gpu/gl/GrGpuGL.cpp
index d1a7167..50d2a1f 100644
--- a/gpu/gl/GrGpuGL.cpp
+++ b/gpu/gl/GrGpuGL.cpp
@@ -1271,14 +1271,16 @@
}
void GrGpuGL::flushScissor() {
- const GrDrawState& drawState = this->getDrawState();
- const GrGLRenderTarget* rt =
- static_cast<const GrGLRenderTarget*>(drawState.getRenderTarget());
-
- SkASSERT(NULL != rt);
- const GrGLIRect& vp = rt->getViewport();
-
if (fScissorState.fEnabled) {
+ // Only access the RT if scissoring is being enabled. We can call this before performing
+ // a glBitframebuffer for a surface->surface copy, which requires no RT to be bound to the
+ // GrDrawState.
+ const GrDrawState& drawState = this->getDrawState();
+ const GrGLRenderTarget* rt =
+ static_cast<const GrGLRenderTarget*>(drawState.getRenderTarget());
+
+ SkASSERT(NULL != rt);
+ const GrGLIRect& vp = rt->getViewport();
GrGLIRect scissor;
scissor.setRelativeTo(vp,
fScissorState.fRect.fLeft,