Chromium Code Reviews| Index: cc/layers/video_layer_impl.cc |
| diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc |
| index 228f2ccdc8404341b54770e8271d8dfad4e1f9e6..a3246dd8f265f5025e23c5b8a54a86c4bc4283ed 100644 |
| --- a/cc/layers/video_layer_impl.cc |
| +++ b/cc/layers/video_layer_impl.cc |
| @@ -17,6 +17,7 @@ |
| #include "cc/trees/occlusion.h" |
| #include "cc/trees/proxy.h" |
| #include "media/base/video_frame.h" |
| +#include "ui/gfx/geometry/rect_conversions.h" |
| #if defined(VIDEO_HOLE) |
| #include "cc/quads/solid_color_draw_quad.h" |
| @@ -43,7 +44,8 @@ VideoLayerImpl::VideoLayerImpl(LayerTreeImpl* tree_impl, |
| media::VideoRotation video_rotation) |
| : LayerImpl(tree_impl, id), |
| frame_(nullptr), |
| - video_rotation_(video_rotation) { |
| + video_rotation_(video_rotation), |
| + video_can_overlay_(false) { |
| } |
| VideoLayerImpl::~VideoLayerImpl() { |
| @@ -125,9 +127,9 @@ bool VideoLayerImpl::WillDraw(DrawMode draw_mode, |
| external_resources.mailboxes[i], |
| SingleReleaseCallbackImpl::Create( |
| external_resources.release_callbacks[i])); |
| + video_can_overlay_ = resource_provider->AllowOverlay(resource_id); |
|
danakj
2015/04/03 22:10:17
this is in a loop, so it would only take the value
achaulk
2015/04/07 18:52:59
Ah, yeah I'll probably just move it outside the lo
|
| frame_resources_.push_back(resource_id); |
| } |
| - |
| return true; |
| } |
| @@ -216,6 +218,7 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass, |
| opacity, |
| flipped, |
| nearest_neighbor); |
| + texture_quad->damaged = video_can_overlay_; |
| break; |
| } |
| case VideoFrameExternalResources::YUV_RESOURCE: { |
| @@ -238,6 +241,7 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass, |
| tex_coord_rect, coded_size, frame_resources_[0], frame_resources_[1], |
| frame_resources_[2], |
| frame_resources_.size() > 3 ? frame_resources_[3] : 0, color_space); |
| + yuv_video_quad->damaged = video_can_overlay_; |
| break; |
| } |
| case VideoFrameExternalResources::RGB_RESOURCE: { |
| @@ -264,6 +268,7 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass, |
| opacity, |
| flipped, |
| nearest_neighbor); |
| + texture_quad->damaged = video_can_overlay_; |
| break; |
| } |
| case VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE: { |
| @@ -281,6 +286,7 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass, |
| visible_quad_rect, |
| frame_resources_[0], |
| scale * provider_client_impl_->stream_texture_matrix()); |
| + stream_video_quad->damaged = video_can_overlay_; |
| break; |
| } |
| case VideoFrameExternalResources::IO_SURFACE: { |
| @@ -296,6 +302,7 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass, |
| visible_rect.size(), |
| frame_resources_[0], |
| IOSurfaceDrawQuad::UNFLIPPED); |
| + io_surface_quad->damaged = video_can_overlay_; |
| break; |
| } |
| #if defined(VIDEO_HOLE) |
| @@ -360,7 +367,11 @@ void VideoLayerImpl::ReleaseResources() { |
| } |
| void VideoLayerImpl::SetNeedsRedraw() { |
| - SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); |
| + if (video_can_overlay_) |
| + SetOverlayUpdateRect( |
| + gfx::UnionRects(overlay_update_rect(), gfx::Rect(bounds()))); |
| + else |
| + SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); |
| layer_tree_impl()->SetNeedsRedraw(); |
| } |