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 "cc/gl_renderer.h" | 5 #include "cc/gl_renderer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
982 | 982 |
983 void GLRenderer::drawStreamVideoQuad(const DrawingFrame& frame, const StreamVide oDrawQuad* quad) | 983 void GLRenderer::drawStreamVideoQuad(const DrawingFrame& frame, const StreamVide oDrawQuad* quad) |
984 { | 984 { |
985 static float glMatrix[16]; | 985 static float glMatrix[16]; |
986 | 986 |
987 DCHECK(m_capabilities.usingEglImage); | 987 DCHECK(m_capabilities.usingEglImage); |
988 | 988 |
989 const VideoStreamTextureProgram* program = videoStreamTextureProgram(); | 989 const VideoStreamTextureProgram* program = videoStreamTextureProgram(); |
990 setUseProgram(program->program()); | 990 setUseProgram(program->program()); |
991 | 991 |
992 if (quad->texture_id == 0) { | |
Vangelis Kokkevis
2013/02/21 18:52:54
I'm not too fond of the idea of using texture_id =
danakj
2013/02/21 19:01:51
That sounds like a solid color quad with needs ble
wonsik2
2013/02/26 04:52:24
Created a new quad type; PTAL
wonsik2
2013/02/26 04:52:24
I tried SolidColorDrawQuad with needs_blending ==
wonsik2
2013/02/26 06:47:03
With further investigation, it turned out that an
| |
993 // When texture_id == 0, punch a hole instead of rendering. The video | |
994 // will be composited outside of Chrome rendering pipeline, and where | |
995 // video should be composited should remain transparent in this case. | |
996 GLC(m_context, m_context->blendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA)); | |
997 drawQuadGeometry(frame, quad->quadTransform(), quad->rect, program->vert exShader().matrixLocation()); | |
998 GLC(m_context, m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); | |
999 return; | |
1000 } | |
1001 | |
992 toGLMatrix(&glMatrix[0], quad->matrix); | 1002 toGLMatrix(&glMatrix[0], quad->matrix); |
993 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().texMatrix Location(), 1, false, glMatrix)); | 1003 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().texMatrix Location(), 1, false, glMatrix)); |
994 | 1004 |
995 GLC(context(), context()->bindTexture(GL_TEXTURE_EXTERNAL_OES, quad->texture _id)); | 1005 GLC(context(), context()->bindTexture(GL_TEXTURE_EXTERNAL_OES, quad->texture _id)); |
996 | 1006 |
997 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio n(), 0)); | 1007 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio n(), 0)); |
998 | 1008 |
999 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation()) ; | 1009 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation()) ; |
1000 drawQuadGeometry(frame, quad->quadTransform(), quad->rect, program->vertexSh ader().matrixLocation()); | 1010 drawQuadGeometry(frame, quad->quadTransform(), quad->rect, program->vertexSh ader().matrixLocation()); |
1001 } | 1011 } |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1831 | 1841 |
1832 releaseRenderPassTextures(); | 1842 releaseRenderPassTextures(); |
1833 } | 1843 } |
1834 | 1844 |
1835 bool GLRenderer::isContextLost() | 1845 bool GLRenderer::isContextLost() |
1836 { | 1846 { |
1837 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1847 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
1838 } | 1848 } |
1839 | 1849 |
1840 } // namespace cc | 1850 } // namespace cc |
OLD | NEW |