| Index: cc/output/gl_renderer.cc
|
| diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
|
| index f2029f3a50d60dd1db9d4e65015c310ebe783a28..45d98b638859e2cadc76d4257740ee844ab2fcbc 100644
|
| --- a/cc/output/gl_renderer.cc
|
| +++ b/cc/output/gl_renderer.cc
|
| @@ -1832,6 +1832,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;
|
| @@ -1852,6 +1853,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);
|
| @@ -1865,6 +1867,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();
|
| }
|
|
|
| @@ -1876,6 +1879,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));
|
|
|