Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(599)

Unified Diff: cc/layers/video_layer_impl.cc

Issue 1645353003: VideoLayerImpl: subtract 1 from visible size when calculating tex stretch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do not stretch visible_rect of IO_SURFACE Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/video_layer_impl.cc
diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc
index 39b8ef20c59f072bcbc8f6815aa9d66ea8a82edb..923767e526348c35363039edf2c83f2bc97d734d 100644
--- a/cc/layers/video_layer_impl.cc
+++ b/cc/layers/video_layer_impl.cc
@@ -184,11 +184,17 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass,
if (visible_quad_rect.IsEmpty())
return;
- // Pixels for macroblocked formats.
+ // Pixels for macroblocked formats. To prevent sampling outside the visible
+ // rect, stretch the video if needed.
+ gfx::Rect visible_sample_rect = frame_->visible_rect();
+ if (visible_rect.width() < coded_size.width() && visible_rect.width() > 1)
+ visible_sample_rect.set_width(visible_rect.width() - 1);
+ if (visible_rect.height() < coded_size.height() && visible_rect.height() > 1)
+ visible_sample_rect.set_height(visible_rect.height() - 1);
const float tex_width_scale =
- static_cast<float>(visible_rect.width()) / coded_size.width();
+ static_cast<float>(visible_sample_rect.width()) / coded_size.width();
const float tex_height_scale =
- static_cast<float>(visible_rect.height()) / coded_size.height();
+ static_cast<float>(visible_sample_rect.height()) / coded_size.height();
switch (frame_resource_type_) {
// TODO(danakj): Remove this, hide it in the hardware path.
@@ -257,12 +263,12 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass,
static_cast<float>(ya_tex_size.width()) / uv_tex_size.width();
float uv_subsampling_factor_y =
static_cast<float>(ya_tex_size.height()) / uv_tex_size.height();
- gfx::RectF ya_tex_coord_rect(visible_rect);
+ gfx::RectF ya_tex_coord_rect(visible_sample_rect);
gfx::RectF uv_tex_coord_rect(
- visible_rect.x() / uv_subsampling_factor_x,
- visible_rect.y() / uv_subsampling_factor_y,
- visible_rect.width() / uv_subsampling_factor_x,
- visible_rect.height() / uv_subsampling_factor_y);
+ visible_sample_rect.x() / uv_subsampling_factor_x,
+ visible_sample_rect.y() / uv_subsampling_factor_y,
+ visible_sample_rect.width() / uv_subsampling_factor_x,
+ visible_sample_rect.height() / uv_subsampling_factor_y);
YUVVideoDrawQuad* yuv_video_quad =
render_pass->CreateAndAppendDrawQuad<YUVVideoDrawQuad>();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698