diff options
author | enne <enne@chromium.org> | 2015-02-02 14:21:21 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-02 22:22:40 +0000 |
commit | a2a2970d72e7856444896600874fca9594f55437 (patch) | |
tree | 55ea581e330372d9a7f510392ee5a15d499fe0f7 /cc/quads/yuv_video_draw_quad.h | |
parent | c90fb30a52bff2da52dc74a6097ba883978dba1d (diff) | |
download | chromium_src-a2a2970d72e7856444896600874fca9594f55437.zip chromium_src-a2a2970d72e7856444896600874fca9594f55437.tar.gz chromium_src-a2a2970d72e7856444896600874fca9594f55437.tar.bz2 |
Clamp YUV videos to their visible size in the shader
Video textures can be larger than the visible size of the video.
Because they have bilinear filtering turned on for them, if the video is
scaled, then the this means that the part of the texture outside of the
video itself can be sampled, causing odd visible artifacts like
hairlines on the side of the image.
To fix this, pass in a clamp value of half a pixel (because of bilinear
filtering) inside of the visible rect and clamp all texture coordinates
to this maximum value in the fragment shader.
BUG=429640
Review URL: https://codereview.chromium.org/881963002
Cr-Commit-Position: refs/heads/master@{#314200}
Diffstat (limited to 'cc/quads/yuv_video_draw_quad.h')
-rw-r--r-- | cc/quads/yuv_video_draw_quad.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cc/quads/yuv_video_draw_quad.h b/cc/quads/yuv_video_draw_quad.h index e1c5410..61f11a2 100644 --- a/cc/quads/yuv_video_draw_quad.h +++ b/cc/quads/yuv_video_draw_quad.h @@ -30,6 +30,7 @@ class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { const gfx::Rect& opaque_rect, const gfx::Rect& visible_rect, const gfx::RectF& tex_coord_rect, + const gfx::Size& tex_size, unsigned y_plane_resource_id, unsigned u_plane_resource_id, unsigned v_plane_resource_id, @@ -42,6 +43,7 @@ class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { const gfx::Rect& visible_rect, bool needs_blending, const gfx::RectF& tex_coord_rect, + const gfx::Size& tex_size, unsigned y_plane_resource_id, unsigned u_plane_resource_id, unsigned v_plane_resource_id, @@ -49,6 +51,8 @@ class CC_EXPORT YUVVideoDrawQuad : public DrawQuad { ColorSpace color_space); gfx::RectF tex_coord_rect; + // Empty texture size implies no clamping of texture coordinates. + gfx::Size tex_size; unsigned y_plane_resource_id; unsigned u_plane_resource_id; unsigned v_plane_resource_id; |