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

Side by Side 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: also stretch the video for YUV_RESOURCE Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/video_layer_impl.h" 5 #include "cc/layers/video_layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 Occlusion occlusion_in_video_space = 178 Occlusion occlusion_in_video_space =
179 draw_properties() 179 draw_properties()
180 .occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( 180 .occlusion_in_content_space.GetOcclusionWithGivenDrawTransform(
181 transform); 181 transform);
182 gfx::Rect visible_quad_rect = 182 gfx::Rect visible_quad_rect =
183 occlusion_in_video_space.GetUnoccludedContentRect(quad_rect); 183 occlusion_in_video_space.GetUnoccludedContentRect(quad_rect);
184 if (visible_quad_rect.IsEmpty()) 184 if (visible_quad_rect.IsEmpty())
185 return; 185 return;
186 186
187 // Pixels for macroblocked formats. 187 // Pixels for macroblocked formats. To prevent sampling outside the visible
188 // rect, stretch the video if needed.
189 if (visible_rect.width() < coded_size.width() && visible_rect.width() > 1)
190 visible_rect.set_width(visible_rect.width() - 1);
191 if (visible_rect.height() < coded_size.height() && visible_rect.height() > 1)
192 visible_rect.set_height(visible_rect.height() - 1);
188 const float tex_width_scale = 193 const float tex_width_scale =
189 static_cast<float>(visible_rect.width()) / coded_size.width(); 194 static_cast<float>(visible_rect.width()) / coded_size.width();
190 const float tex_height_scale = 195 const float tex_height_scale =
191 static_cast<float>(visible_rect.height()) / coded_size.height(); 196 static_cast<float>(visible_rect.height()) / coded_size.height();
192 197
193 switch (frame_resource_type_) { 198 switch (frame_resource_type_) {
194 // TODO(danakj): Remove this, hide it in the hardware path. 199 // TODO(danakj): Remove this, hide it in the hardware path.
195 case VideoFrameExternalResources::SOFTWARE_RESOURCE: { 200 case VideoFrameExternalResources::SOFTWARE_RESOURCE: {
196 DCHECK_EQ(frame_resources_.size(), 0u); 201 DCHECK_EQ(frame_resources_.size(), 0u);
197 DCHECK_EQ(software_resources_.size(), 1u); 202 DCHECK_EQ(software_resources_.size(), 1u);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 ValidateQuadResources(stream_video_quad); 320 ValidateQuadResources(stream_video_quad);
316 break; 321 break;
317 } 322 }
318 case VideoFrameExternalResources::IO_SURFACE: { 323 case VideoFrameExternalResources::IO_SURFACE: {
319 DCHECK_EQ(frame_resources_.size(), 1u); 324 DCHECK_EQ(frame_resources_.size(), 1u);
320 if (frame_resources_.size() < 1u) 325 if (frame_resources_.size() < 1u)
321 break; 326 break;
322 IOSurfaceDrawQuad* io_surface_quad = 327 IOSurfaceDrawQuad* io_surface_quad =
323 render_pass->CreateAndAppendDrawQuad<IOSurfaceDrawQuad>(); 328 render_pass->CreateAndAppendDrawQuad<IOSurfaceDrawQuad>();
324 io_surface_quad->SetNew(shared_quad_state, quad_rect, opaque_rect, 329 io_surface_quad->SetNew(shared_quad_state, quad_rect, opaque_rect,
325 visible_quad_rect, visible_rect.size(), 330 visible_quad_rect, visible_rect.size(),
wuchengli 2016/02/02 08:54:50 |visible_rect| is also used here. Is it correct?
326 frame_resources_[0].id, 331 frame_resources_[0].id,
327 IOSurfaceDrawQuad::UNFLIPPED); 332 IOSurfaceDrawQuad::UNFLIPPED);
328 ValidateQuadResources(io_surface_quad); 333 ValidateQuadResources(io_surface_quad);
329 break; 334 break;
330 } 335 }
331 #if defined(VIDEO_HOLE) 336 #if defined(VIDEO_HOLE)
332 // This block and other blocks wrapped around #if defined(VIDEO_HOLE) is not 337 // This block and other blocks wrapped around #if defined(VIDEO_HOLE) is not
333 // maintained by the general compositor team. Please contact the following 338 // maintained by the general compositor team. Please contact the following
334 // people instead: 339 // people instead:
335 // 340 //
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 void VideoLayerImpl::SetNeedsRedraw() { 406 void VideoLayerImpl::SetNeedsRedraw() {
402 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); 407 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds())));
403 layer_tree_impl()->SetNeedsRedraw(); 408 layer_tree_impl()->SetNeedsRedraw();
404 } 409 }
405 410
406 const char* VideoLayerImpl::LayerTypeAsString() const { 411 const char* VideoLayerImpl::LayerTypeAsString() const {
407 return "cc::VideoLayerImpl"; 412 return "cc::VideoLayerImpl";
408 } 413 }
409 414
410 } // namespace cc 415 } // namespace cc
OLDNEW
« 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