| Index: cc/output/gl_renderer.cc
|
| diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
|
| index e40a4fc44fff24906cbb6c4a71f2e9385cf7cdc5..5a15efa89fd9d3587b53d491c9b175b592bb7f34 100644
|
| --- a/cc/output/gl_renderer.cc
|
| +++ b/cc/output/gl_renderer.cc
|
| @@ -10,8 +10,8 @@
|
| #include <string>
|
| #include <vector>
|
|
|
| -#include "base/debug/trace_event.h"
|
| #include "base/logging.h"
|
| +#include "base/trace_event/trace_event.h"
|
| #include "cc/base/math_util.h"
|
| #include "cc/output/compositor_frame.h"
|
| #include "cc/output/compositor_frame_metadata.h"
|
| @@ -1831,6 +1831,7 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame,
|
| int matrix_location = -1;
|
| int tex_scale_location = -1;
|
| int tex_offset_location = -1;
|
| + int clamp_rect_location = -1;
|
| int y_texture_location = -1;
|
| int u_texture_location = -1;
|
| int v_texture_location = -1;
|
| @@ -1851,6 +1852,7 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame,
|
| a_texture_location = program->fragment_shader().a_texture_location();
|
| yuv_matrix_location = program->fragment_shader().yuv_matrix_location();
|
| yuv_adj_location = program->fragment_shader().yuv_adj_location();
|
| + clamp_rect_location = program->fragment_shader().clamp_rect_location();
|
| alpha_location = program->fragment_shader().alpha_location();
|
| } else {
|
| const VideoYUVProgram* program = GetVideoYUVProgram(tex_coord_precision);
|
| @@ -1864,6 +1866,7 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame,
|
| v_texture_location = program->fragment_shader().v_texture_location();
|
| yuv_matrix_location = program->fragment_shader().yuv_matrix_location();
|
| yuv_adj_location = program->fragment_shader().yuv_adj_location();
|
| + clamp_rect_location = program->fragment_shader().clamp_rect_location();
|
| alpha_location = program->fragment_shader().alpha_location();
|
| }
|
|
|
| @@ -1875,6 +1878,17 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame,
|
| gl_->Uniform2f(tex_offset_location,
|
| quad->tex_coord_rect.x(),
|
| quad->tex_coord_rect.y()));
|
| + // Clamping to half a texel inside the tex coord rect prevents bilinear
|
| + // filtering from filtering outside the tex coord rect.
|
| + gfx::RectF clamp_rect(quad->tex_coord_rect);
|
| + // Special case: empty texture size implies no clamping.
|
| + if (!quad->tex_size.IsEmpty()) {
|
| + clamp_rect.Inset(0.5f / quad->tex_size.width(),
|
| + 0.5f / quad->tex_size.height());
|
| + }
|
| + GLC(gl_, gl_->Uniform4f(clamp_rect_location, clamp_rect.x(), clamp_rect.y(),
|
| + clamp_rect.right(), clamp_rect.bottom()));
|
| +
|
| GLC(gl_, gl_->Uniform1i(y_texture_location, 1));
|
| GLC(gl_, gl_->Uniform1i(u_texture_location, 2));
|
| GLC(gl_, gl_->Uniform1i(v_texture_location, 3));
|
|
|