| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
| 10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 return NULL; | 1264 return NULL; |
| 1265 } | 1265 } |
| 1266 } | 1266 } |
| 1267 | 1267 |
| 1268 GrPath* GrGpuGL::onCreatePath(const SkPath& inPath) { | 1268 GrPath* GrGpuGL::onCreatePath(const SkPath& inPath) { |
| 1269 SkASSERT(this->caps()->pathStencilingSupport()); | 1269 SkASSERT(this->caps()->pathStencilingSupport()); |
| 1270 return SkNEW_ARGS(GrGLPath, (this, inPath)); | 1270 return SkNEW_ARGS(GrGLPath, (this, inPath)); |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 void GrGpuGL::flushScissor() { | 1273 void GrGpuGL::flushScissor() { |
| 1274 const GrDrawState& drawState = this->getDrawState(); | 1274 if (fScissorState.fEnabled) { |
| 1275 const GrGLRenderTarget* rt = | 1275 // Only access the RT if scissoring is being enabled. We can call this b
efore performing |
| 1276 static_cast<const GrGLRenderTarget*>(drawState.getRenderTarget()); | 1276 // a glBitframebuffer for a surface->surface copy, which requires no RT
to be bound to the |
| 1277 // GrDrawState. |
| 1278 const GrDrawState& drawState = this->getDrawState(); |
| 1279 const GrGLRenderTarget* rt = |
| 1280 static_cast<const GrGLRenderTarget*>(drawState.getRenderTarget()); |
| 1277 | 1281 |
| 1278 SkASSERT(NULL != rt); | 1282 SkASSERT(NULL != rt); |
| 1279 const GrGLIRect& vp = rt->getViewport(); | 1283 const GrGLIRect& vp = rt->getViewport(); |
| 1280 | |
| 1281 if (fScissorState.fEnabled) { | |
| 1282 GrGLIRect scissor; | 1284 GrGLIRect scissor; |
| 1283 scissor.setRelativeTo(vp, | 1285 scissor.setRelativeTo(vp, |
| 1284 fScissorState.fRect.fLeft, | 1286 fScissorState.fRect.fLeft, |
| 1285 fScissorState.fRect.fTop, | 1287 fScissorState.fRect.fTop, |
| 1286 fScissorState.fRect.width(), | 1288 fScissorState.fRect.width(), |
| 1287 fScissorState.fRect.height(), | 1289 fScissorState.fRect.height(), |
| 1288 rt->origin()); | 1290 rt->origin()); |
| 1289 // if the scissor fully contains the viewport then we fall through and | 1291 // if the scissor fully contains the viewport then we fall through and |
| 1290 // disable the scissor test. | 1292 // disable the scissor test. |
| 1291 if (!scissor.contains(vp)) { | 1293 if (!scissor.contains(vp)) { |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2588 this->setVertexArrayID(gpu, 0); | 2590 this->setVertexArrayID(gpu, 0); |
| 2589 } | 2591 } |
| 2590 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2592 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2591 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2593 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2592 fDefaultVertexArrayAttribState.resize(attrCount); | 2594 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2593 } | 2595 } |
| 2594 attribState = &fDefaultVertexArrayAttribState; | 2596 attribState = &fDefaultVertexArrayAttribState; |
| 2595 } | 2597 } |
| 2596 return attribState; | 2598 return attribState; |
| 2597 } | 2599 } |
| OLD | NEW |