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

Side by Side Diff: ui/gl/yuv_to_rgb_converter.cc

Issue 1980183002: Workaround for Mac video flickering (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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
« ui/gl/yuv_to_rgb_converter.h ('K') | « ui/gl/yuv_to_rgb_converter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/gl/yuv_to_rgb_converter.h" 5 #include "ui/gl/yuv_to_rgb_converter.h"
6 6
7 #include "base/strings/stringize_macros.h" 7 #include "base/strings/stringize_macros.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "ui/gl/gl_helper.h" 9 #include "ui/gl/gl_helper.h"
10 #include "ui/gl/gl_implementation.h" 10 #include "ui/gl/gl_implementation.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 program_ = gfx::GLHelper::SetupProgram(vertex_shader_, fragment_shader_); 93 program_ = gfx::GLHelper::SetupProgram(vertex_shader_, fragment_shader_);
94 94
95 gfx::ScopedUseProgram use_program(program_); 95 gfx::ScopedUseProgram use_program(program_);
96 size_location_ = glGetUniformLocation(program_, "a_texScale"); 96 size_location_ = glGetUniformLocation(program_, "a_texScale");
97 DCHECK_NE(-1, size_location_); 97 DCHECK_NE(-1, size_location_);
98 int y_sampler_location = glGetUniformLocation(program_, "a_y_texture"); 98 int y_sampler_location = glGetUniformLocation(program_, "a_y_texture");
99 DCHECK_NE(-1, y_sampler_location); 99 DCHECK_NE(-1, y_sampler_location);
100 int uv_sampler_location = glGetUniformLocation(program_, "a_uv_texture"); 100 int uv_sampler_location = glGetUniformLocation(program_, "a_uv_texture");
101 DCHECK_NE(-1, uv_sampler_location); 101 DCHECK_NE(-1, uv_sampler_location);
102 102
103 glGenTextures(1, &y_texture_);
104 glGenTextures(1, &uv_texture_);
105
103 glUniform1i(y_sampler_location, 0); 106 glUniform1i(y_sampler_location, 0);
104 glUniform1i(uv_sampler_location, 1); 107 glUniform1i(uv_sampler_location, 1);
105 } 108 }
106 109
107 YUVToRGBConverter::~YUVToRGBConverter() { 110 YUVToRGBConverter::~YUVToRGBConverter() {
108 gfx::ScopedSetGLToRealGLApi scoped_set_gl_api; 111 gfx::ScopedSetGLToRealGLApi scoped_set_gl_api;
112 glDeleteTextures(1, &y_texture_);
113 glDeleteTextures(1, &uv_texture_);
109 glDeleteProgram(program_); 114 glDeleteProgram(program_);
110 glDeleteShader(vertex_shader_); 115 glDeleteShader(vertex_shader_);
111 glDeleteShader(fragment_shader_); 116 glDeleteShader(fragment_shader_);
112 glDeleteBuffersARB(1, &vertex_buffer_); 117 glDeleteBuffersARB(1, &vertex_buffer_);
113 glDeleteFramebuffersEXT(1, &framebuffer_); 118 glDeleteFramebuffersEXT(1, &framebuffer_);
114 } 119 }
115 120
116 void YUVToRGBConverter::CopyYUV420ToRGB(unsigned target, 121 void YUVToRGBConverter::CopyYUV420ToRGB(unsigned target,
117 unsigned y_texture, 122 unsigned y_texture,
118 unsigned uv_texture, 123 unsigned uv_texture,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, 162 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
158 GL_TEXTURE_RECTANGLE_ARB, 0, 0); 163 GL_TEXTURE_RECTANGLE_ARB, 0, 0);
159 glActiveTexture(GL_TEXTURE0); 164 glActiveTexture(GL_TEXTURE0);
160 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, old_texture0_binding); 165 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, old_texture0_binding);
161 glActiveTexture(GL_TEXTURE1); 166 glActiveTexture(GL_TEXTURE1);
162 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, old_texture1_binding); 167 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, old_texture1_binding);
163 glActiveTexture(old_active_texture); 168 glActiveTexture(old_active_texture);
164 } 169 }
165 170
166 } // namespace gl 171 } // namespace gl
OLDNEW
« ui/gl/yuv_to_rgb_converter.h ('K') | « ui/gl/yuv_to_rgb_converter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698