| 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 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 r = GrColorUnpackR(color) * scaleRGB; | 1288 r = GrColorUnpackR(color) * scaleRGB; |
| 1289 g = GrColorUnpackG(color) * scaleRGB; | 1289 g = GrColorUnpackG(color) * scaleRGB; |
| 1290 b = GrColorUnpackB(color) * scaleRGB; | 1290 b = GrColorUnpackB(color) * scaleRGB; |
| 1291 | 1291 |
| 1292 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); | 1292 GL_CALL(ColorMask(GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE, GR_GL_TRUE)); |
| 1293 fHWWriteToColor = kYes_TriState; | 1293 fHWWriteToColor = kYes_TriState; |
| 1294 GL_CALL(ClearColor(r, g, b, a)); | 1294 GL_CALL(ClearColor(r, g, b, a)); |
| 1295 GL_CALL(Clear(GR_GL_COLOR_BUFFER_BIT)); | 1295 GL_CALL(Clear(GR_GL_COLOR_BUFFER_BIT)); |
| 1296 } | 1296 } |
| 1297 | 1297 |
| 1298 void GrGpuGL::discard(GrRenderTarget* renderTarget) { |
| 1299 if (NULL == renderTarget) { |
| 1300 renderTarget = this->drawState()->getRenderTarget(); |
| 1301 if (NULL == renderTarget) { |
| 1302 return; |
| 1303 } |
| 1304 } |
| 1305 |
| 1306 GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(renderTarget); |
| 1307 if (renderTarget != fHWBoundRenderTarget) { |
| 1308 fHWBoundRenderTarget = NULL; |
| 1309 GL_CALL(BindFramebuffer(GR_GL_FRAMEBUFFER, glRT->renderFBOID())); |
| 1310 } |
| 1311 GrGLenum attachments[] = { GR_GL_COLOR }; |
| 1312 GL_CALL(DiscardFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(attachments), a
ttachments)); |
| 1313 renderTarget->flagAsResolved(); |
| 1314 } |
| 1315 |
| 1316 |
| 1298 void GrGpuGL::clearStencil() { | 1317 void GrGpuGL::clearStencil() { |
| 1299 if (NULL == this->getDrawState().getRenderTarget()) { | 1318 if (NULL == this->getDrawState().getRenderTarget()) { |
| 1300 return; | 1319 return; |
| 1301 } | 1320 } |
| 1302 | 1321 |
| 1303 this->flushRenderTarget(&SkIRect::EmptyIRect()); | 1322 this->flushRenderTarget(&SkIRect::EmptyIRect()); |
| 1304 | 1323 |
| 1305 GrAutoTRestore<ScissorState> asr(&fScissorState); | 1324 GrAutoTRestore<ScissorState> asr(&fScissorState); |
| 1306 fScissorState.fEnabled = false; | 1325 fScissorState.fEnabled = false; |
| 1307 this->flushScissor(); | 1326 this->flushScissor(); |
| (...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2789 this->setVertexArrayID(gpu, 0); | 2808 this->setVertexArrayID(gpu, 0); |
| 2790 } | 2809 } |
| 2791 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2810 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2792 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2811 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2793 fDefaultVertexArrayAttribState.resize(attrCount); | 2812 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2794 } | 2813 } |
| 2795 attribState = &fDefaultVertexArrayAttribState; | 2814 attribState = &fDefaultVertexArrayAttribState; |
| 2796 } | 2815 } |
| 2797 return attribState; | 2816 return attribState; |
| 2798 } | 2817 } |
| OLD | NEW |