OLD | NEW |
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_version_info.h" | 10 #include "ui/gl/gl_version_info.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // Allocate the rgb texture. | 136 // Allocate the rgb texture. |
137 glBindTexture(target, rgb_texture); | 137 glBindTexture(target, rgb_texture); |
138 glTexImage2D(target, 0, GL_RGB, size.width(), size.height(), | 138 glTexImage2D(target, 0, GL_RGB, size.width(), size.height(), |
139 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr); | 139 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr); |
140 | 140 |
141 // Set up and issue the draw call. | 141 // Set up and issue the draw call. |
142 glActiveTexture(GL_TEXTURE0); | 142 glActiveTexture(GL_TEXTURE0); |
143 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, y_texture_); | 143 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, y_texture_); |
144 glActiveTexture(GL_TEXTURE1); | 144 glActiveTexture(GL_TEXTURE1); |
145 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, uv_texture_); | 145 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, uv_texture_); |
146 ScopedFrameBufferBinder framebuffer_binder(framebuffer_); | 146 ScopedFramebufferBinder framebuffer_binder(framebuffer_); |
147 ScopedViewport viewport(0, 0, size.width(), size.height()); | 147 ScopedViewport viewport(0, 0, size.width(), size.height()); |
148 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 148 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
149 target, rgb_texture, 0); | 149 target, rgb_texture, 0); |
150 DCHECK_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), | 150 DCHECK_EQ(static_cast<GLenum>(GL_FRAMEBUFFER_COMPLETE), |
151 glCheckFramebufferStatusEXT(GL_FRAMEBUFFER)); | 151 glCheckFramebufferStatusEXT(GL_FRAMEBUFFER)); |
152 ScopedUseProgram use_program(program_); | 152 ScopedUseProgram use_program(program_); |
153 glUniform2f(size_location_, size.width(), size.height()); | 153 glUniform2f(size_location_, size.width(), size.height()); |
154 GLHelper::DrawQuad(vertex_buffer_); | 154 GLHelper::DrawQuad(vertex_buffer_); |
155 | 155 |
156 // Restore previous state. | 156 // Restore previous state. |
157 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 157 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
158 target, 0, 0); | 158 target, 0, 0); |
159 glActiveTexture(GL_TEXTURE0); | 159 glActiveTexture(GL_TEXTURE0); |
160 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, old_texture0_binding); | 160 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, old_texture0_binding); |
161 glActiveTexture(GL_TEXTURE1); | 161 glActiveTexture(GL_TEXTURE1); |
162 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, old_texture1_binding); | 162 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, old_texture1_binding); |
163 glActiveTexture(old_active_texture); | 163 glActiveTexture(old_active_texture); |
164 } | 164 } |
165 | 165 |
166 } // namespace gl | 166 } // namespace gl |
OLD | NEW |