Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: cc/gl_renderer.cc

Issue 11442056: Add external surface rendering mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 929
930 void GLRenderer::drawStreamVideoQuad(const DrawingFrame& frame, const StreamVide oDrawQuad* quad) 930 void GLRenderer::drawStreamVideoQuad(const DrawingFrame& frame, const StreamVide oDrawQuad* quad)
931 { 931 {
932 static float glMatrix[16]; 932 static float glMatrix[16];
933 933
934 DCHECK(m_capabilities.usingEglImage); 934 DCHECK(m_capabilities.usingEglImage);
935 935
936 const VideoStreamTextureProgram* program = videoStreamTextureProgram(); 936 const VideoStreamTextureProgram* program = videoStreamTextureProgram();
937 setUseProgram(program->program()); 937 setUseProgram(program->program());
938 938
939 toGLMatrix(&glMatrix[0], quad->matrix); 939 if (quad->texture_id == 0) {
940 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().texMatrix Location(), 1, false, glMatrix)); 940 // When texture_id == 0, punch a hole instead of rendering.
941 GLC(m_context, m_context->blendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA));
942 drawQuadGeometry(frame, quad->quadTransform(), quad->rect, program->vert exShader().matrixLocation());
943 GLC(m_context, m_context->blendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
944 } else {
danakj 2012/12/13 05:35:42 if you return at the end of the if() then you don'
wonsik2 2012/12/17 04:36:05 Done.
945 toGLMatrix(&glMatrix[0], quad->matrix);
946 GLC(context(), context()->uniformMatrix4fv(program->vertexShader().texMa trixLocation(), 1, false, glMatrix));
941 947
942 GLC(context(), context()->bindTexture(GL_TEXTURE_EXTERNAL_OES, quad->texture _id)); 948 GLC(context(), context()->bindTexture(GL_TEXTURE_EXTERNAL_OES, quad->tex ture_id));
943 949
944 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocatio n(), 0)); 950 GLC(context(), context()->uniform1i(program->fragmentShader().samplerLoc ation(), 0));
945 951
946 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocation()) ; 952 setShaderOpacity(quad->opacity(), program->fragmentShader().alphaLocatio n());
947 drawQuadGeometry(frame, quad->quadTransform(), quad->rect, program->vertexSh ader().matrixLocation()); 953 drawQuadGeometry(frame, quad->quadTransform(), quad->rect, program->vert exShader().matrixLocation());
954 }
948 } 955 }
949 956
950 struct TextureProgramBinding { 957 struct TextureProgramBinding {
951 template<class Program> void set( 958 template<class Program> void set(
952 Program* program, WebKit::WebGraphicsContext3D* context) 959 Program* program, WebKit::WebGraphicsContext3D* context)
953 { 960 {
954 DCHECK(program && (program->initialized() || context->isContextLost())); 961 DCHECK(program && (program->initialized() || context->isContextLost()));
955 programId = program->program(); 962 programId = program->program();
956 samplerLocation = program->fragmentShader().samplerLocation(); 963 samplerLocation = program->fragmentShader().samplerLocation();
957 matrixLocation = program->vertexShader().matrixLocation(); 964 matrixLocation = program->vertexShader().matrixLocation();
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 1753
1747 releaseRenderPassTextures(); 1754 releaseRenderPassTextures();
1748 } 1755 }
1749 1756
1750 bool GLRenderer::isContextLost() 1757 bool GLRenderer::isContextLost()
1751 { 1758 {
1752 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); 1759 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR);
1753 } 1760 }
1754 1761
1755 } // namespace cc 1762 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | content/browser/android/content_video_view.h » ('j') | content/browser/android/media_player_manager_android.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698