OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/gl_renderer.h" | 7 #include "cc/gl_renderer.h" |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 m_isViewportChanged = false; | 232 m_isViewportChanged = false; |
233 m_context->reshape(viewportWidth(), viewportHeight()); | 233 m_context->reshape(viewportWidth(), viewportHeight()); |
234 } | 234 } |
235 | 235 |
236 makeContextCurrent(); | 236 makeContextCurrent(); |
237 // Bind the common vertex attributes used for drawing all the layers. | 237 // Bind the common vertex attributes used for drawing all the layers. |
238 m_sharedGeometry->prepareForDraw(); | 238 m_sharedGeometry->prepareForDraw(); |
239 | 239 |
240 GLC(m_context, m_context->disable(GL_DEPTH_TEST)); | 240 GLC(m_context, m_context->disable(GL_DEPTH_TEST)); |
241 GLC(m_context, m_context->disable(GL_CULL_FACE)); | 241 GLC(m_context, m_context->disable(GL_CULL_FACE)); |
| 242 GLC(m_context, m_context->enable(GL_SCISSOR_TEST)); |
242 GLC(m_context, m_context->colorMask(true, true, true, true)); | 243 GLC(m_context, m_context->colorMask(true, true, true, true)); |
243 GLC(m_context, m_context->enable(GL_BLEND)); | 244 GLC(m_context, m_context->enable(GL_BLEND)); |
244 GLC(m_context, m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); | 245 GLC(m_context, m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); |
245 } | 246 } |
246 | 247 |
247 void GLRenderer::doNoOp() | 248 void GLRenderer::doNoOp() |
248 { | 249 { |
249 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); | 250 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0)); |
250 GLC(m_context, m_context->flush()); | 251 GLC(m_context, m_context->flush()); |
251 } | 252 } |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.mat
rixLocation); | 1016 drawQuadGeometry(frame, quad->quadTransform(), quad->quadRect(), binding.mat
rixLocation); |
1016 | 1017 |
1017 GLC(context(), context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0)); | 1018 GLC(context(), context()->bindTexture(GL_TEXTURE_RECTANGLE_ARB, 0)); |
1018 } | 1019 } |
1019 | 1020 |
1020 void GLRenderer::finishDrawingFrame(DrawingFrame& frame) | 1021 void GLRenderer::finishDrawingFrame(DrawingFrame& frame) |
1021 { | 1022 { |
1022 m_currentFramebufferLock.reset(); | 1023 m_currentFramebufferLock.reset(); |
1023 m_swapBufferRect.Union(gfx::ToEnclosingRect(frame.rootDamageRect)); | 1024 m_swapBufferRect.Union(gfx::ToEnclosingRect(frame.rootDamageRect)); |
1024 | 1025 |
1025 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); | |
1026 GLC(m_context, m_context->disable(GL_BLEND)); | 1026 GLC(m_context, m_context->disable(GL_BLEND)); |
1027 } | 1027 } |
1028 | 1028 |
1029 bool GLRenderer::flippedFramebuffer() const | 1029 bool GLRenderer::flippedFramebuffer() const |
1030 { | 1030 { |
1031 return true; | 1031 return true; |
1032 } | 1032 } |
1033 | 1033 |
1034 void GLRenderer::toGLMatrix(float* flattened, const WebTransformationMatrix& m) | 1034 void GLRenderer::toGLMatrix(float* flattened, const WebTransformationMatrix& m) |
1035 { | 1035 { |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, textureId, 0)); | 1343 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, textureId, 0)); |
1344 | 1344 |
1345 DCHECK(m_context->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_C
OMPLETE); | 1345 DCHECK(m_context->checkFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_C
OMPLETE); |
1346 | 1346 |
1347 initializeMatrices(frame, framebufferRect, false); | 1347 initializeMatrices(frame, framebufferRect, false); |
1348 setDrawViewportSize(framebufferRect.size()); | 1348 setDrawViewportSize(framebufferRect.size()); |
1349 | 1349 |
1350 return true; | 1350 return true; |
1351 } | 1351 } |
1352 | 1352 |
1353 void GLRenderer::enableScissorTestRect(const gfx::Rect& scissorRect) | 1353 void GLRenderer::setScissorTestRect(const gfx::Rect& scissorRect) |
1354 { | 1354 { |
1355 GLC(m_context, m_context->enable(GL_SCISSOR_TEST)); | |
1356 GLC(m_context, m_context->scissor(scissorRect.x(), scissorRect.y(), scissorR
ect.width(), scissorRect.height())); | 1355 GLC(m_context, m_context->scissor(scissorRect.x(), scissorRect.y(), scissorR
ect.width(), scissorRect.height())); |
1357 } | 1356 } |
1358 | 1357 |
1359 void GLRenderer::disableScissorTest() | |
1360 { | |
1361 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); | |
1362 } | |
1363 | |
1364 void GLRenderer::setDrawViewportSize(const gfx::Size& viewportSize) | 1358 void GLRenderer::setDrawViewportSize(const gfx::Size& viewportSize) |
1365 { | 1359 { |
1366 GLC(m_context, m_context->viewport(0, 0, viewportSize.width(), viewportSize.
height())); | 1360 GLC(m_context, m_context->viewport(0, 0, viewportSize.width(), viewportSize.
height())); |
1367 } | 1361 } |
1368 | 1362 |
1369 bool GLRenderer::makeContextCurrent() | 1363 bool GLRenderer::makeContextCurrent() |
1370 { | 1364 { |
1371 return m_context->makeContextCurrent(); | 1365 return m_context->makeContextCurrent(); |
1372 } | 1366 } |
1373 | 1367 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 | 1619 |
1626 releaseRenderPassTextures(); | 1620 releaseRenderPassTextures(); |
1627 } | 1621 } |
1628 | 1622 |
1629 bool GLRenderer::isContextLost() | 1623 bool GLRenderer::isContextLost() |
1630 { | 1624 { |
1631 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1625 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
1632 } | 1626 } |
1633 | 1627 |
1634 } // namespace cc | 1628 } // namespace cc |
OLD | NEW |