Chromium Code Reviews| 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/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 2174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2185 | 2185 |
| 2186 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 2186 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 2187 gl_, &highp_threshold_cache_, highp_threshold_min_, | 2187 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 2188 quad->shared_quad_state->visible_quad_layer_rect.bottom_right()); | 2188 quad->shared_quad_state->visible_quad_layer_rect.bottom_right()); |
| 2189 | 2189 |
| 2190 const VideoStreamTextureProgram* program = | 2190 const VideoStreamTextureProgram* program = |
| 2191 GetVideoStreamTextureProgram(tex_coord_precision); | 2191 GetVideoStreamTextureProgram(tex_coord_precision); |
| 2192 SetUseProgram(program->program()); | 2192 SetUseProgram(program->program()); |
| 2193 | 2193 |
| 2194 ToGLMatrix(&gl_matrix[0], quad->matrix); | 2194 ToGLMatrix(&gl_matrix[0], quad->matrix); |
| 2195 gl_->UniformMatrix4fv(program->vertex_shader().tex_matrix_location(), 1, | |
| 2196 false, gl_matrix); | |
| 2197 | 2195 |
| 2198 ResourceProvider::ScopedReadLockGL lock(resource_provider_, | 2196 ResourceProvider::ScopedReadLockGL lock(resource_provider_, |
| 2199 quad->resource_id()); | 2197 quad->resource_id()); |
| 2198 | |
| 2200 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); | 2199 DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); |
| 2201 gl_->BindTexture(GL_TEXTURE_EXTERNAL_OES, lock.texture_id()); | 2200 gl_->BindTexture(GL_TEXTURE_EXTERNAL_OES, lock.texture_id()); |
| 2202 | 2201 |
| 2202 // TODO(liberato): stream_texture_android should stop sending |gl_matrix| to | |
| 2203 // the video frame provider with this change (and to us), but it should | |
| 2204 // start reporting the current matrix via GLImage::GetCustomMatrix. Until | |
| 2205 // then, though, this will use the matrix that we provide to it, unless the | |
| 2206 // GLImage overrides it. This lets it also work with AVDACodecImage, which | |
| 2207 // provides the correct custom matrix and supplies a default one to us. | |
| 2208 gl_->UniformMatrix4fvWithCustomMatrixCHROMIUM( | |
| 2209 program->vertex_shader().tex_matrix_location(), 1, | |
| 2210 12345 /* TODO(liberato): enum */, false, gl_matrix); | |
|
piman
2016/02/16 23:56:33
The enum will go to gpu/GLES2/gl2extchromium.h
See
liberato (no reviews please)
2016/02/17 17:50:32
Done.
| |
| 2211 | |
| 2203 gl_->Uniform1i(program->fragment_shader().sampler_location(), 0); | 2212 gl_->Uniform1i(program->fragment_shader().sampler_location(), 0); |
| 2204 | 2213 |
| 2205 SetShaderOpacity(quad->shared_quad_state->opacity, | 2214 SetShaderOpacity(quad->shared_quad_state->opacity, |
| 2206 program->fragment_shader().alpha_location()); | 2215 program->fragment_shader().alpha_location()); |
| 2207 if (!clip_region) { | 2216 if (!clip_region) { |
| 2208 DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform, | 2217 DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform, |
| 2209 gfx::RectF(quad->rect), | 2218 gfx::RectF(quad->rect), |
| 2210 program->vertex_shader().matrix_location()); | 2219 program->vertex_shader().matrix_location()); |
| 2211 } else { | 2220 } else { |
| 2212 gfx::QuadF region_quad(*clip_region); | 2221 gfx::QuadF region_quad(*clip_region); |
| (...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3625 texture_id = pending_overlay_resources_.back()->texture_id(); | 3634 texture_id = pending_overlay_resources_.back()->texture_id(); |
| 3626 } | 3635 } |
| 3627 | 3636 |
| 3628 context_support_->ScheduleOverlayPlane( | 3637 context_support_->ScheduleOverlayPlane( |
| 3629 overlay.plane_z_order, overlay.transform, texture_id, | 3638 overlay.plane_z_order, overlay.transform, texture_id, |
| 3630 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3639 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
| 3631 } | 3640 } |
| 3632 } | 3641 } |
| 3633 | 3642 |
| 3634 } // namespace cc | 3643 } // namespace cc |
| OLD | NEW |