Index: cc/layers/video_layer_impl.cc |
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc |
index 5f18a768ca4dcf0c4b72767843ef7dc31eeccebc..0c43fe9396097cf5ee319eba3ffe5cc90935be98 100644 |
--- a/cc/layers/video_layer_impl.cc |
+++ b/cc/layers/video_layer_impl.cc |
@@ -188,6 +188,13 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass, |
const float tex_y_offset = |
static_cast<float>(visible_rect.y()) / coded_size.height(); |
+ // Vertex shader should clamp to the visible rect, and then minus |
+ // half a pixel (of the coded size) to account for bilinear filtering. |
+ // This prevents sampling outside of the visible rect. |
+ gfx::SizeF half_pixel(0.5f / coded_size.width(), 0.5f / coded_size.height()); |
+ gfx::SizeF clamp_size(tex_width_scale + tex_x_offset - half_pixel.width(), |
+ tex_height_scale + tex_y_offset - half_pixel.height()); |
+ |
switch (frame_resource_type_) { |
// TODO(danakj): Remove this, hide it in the hardware path. |
case VideoFrameExternalResources::SOFTWARE_RESOURCE: { |
@@ -230,16 +237,10 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass, |
YUVVideoDrawQuad* yuv_video_quad = |
render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>(); |
yuv_video_quad->SetNew( |
- shared_quad_state, |
- quad_rect, |
- opaque_rect, |
- visible_quad_rect, |
- tex_coord_rect, |
- frame_resources_[0], |
- frame_resources_[1], |
+ shared_quad_state, quad_rect, opaque_rect, visible_quad_rect, |
+ tex_coord_rect, clamp_size, frame_resources_[0], frame_resources_[1], |
frame_resources_[2], |
- frame_resources_.size() > 3 ? frame_resources_[3] : 0, |
- color_space); |
+ frame_resources_.size() > 3 ? frame_resources_[3] : 0, color_space); |
break; |
} |
case VideoFrameExternalResources::RGB_RESOURCE: { |