| OLD | NEW |
| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "cc/layers/video_frame_provider_client_impl.h" | 9 #include "cc/layers/video_frame_provider_client_impl.h" |
| 10 #include "cc/quads/io_surface_draw_quad.h" | 10 #include "cc/quads/io_surface_draw_quad.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 void VideoLayerImpl::PushPropertiesTo(LayerImpl* layer) { | 67 void VideoLayerImpl::PushPropertiesTo(LayerImpl* layer) { |
| 68 LayerImpl::PushPropertiesTo(layer); | 68 LayerImpl::PushPropertiesTo(layer); |
| 69 | 69 |
| 70 VideoLayerImpl* other = static_cast<VideoLayerImpl*>(layer); | 70 VideoLayerImpl* other = static_cast<VideoLayerImpl*>(layer); |
| 71 other->SetProviderClientImpl(provider_client_impl_); | 71 other->SetProviderClientImpl(provider_client_impl_); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void VideoLayerImpl::DidBecomeActive() { | 74 void VideoLayerImpl::DidBecomeActive() { |
| 75 provider_client_impl_->set_active_video_layer(this); | 75 provider_client_impl_->SetActiveVideoLayer(this); |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool VideoLayerImpl::WillDraw(DrawMode draw_mode, | 78 bool VideoLayerImpl::WillDraw(DrawMode draw_mode, |
| 79 ResourceProvider* resource_provider) { | 79 ResourceProvider* resource_provider) { |
| 80 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) | 80 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) |
| 81 return false; | 81 return false; |
| 82 | 82 |
| 83 // Explicitly acquire and release the provider mutex so it can be held from | 83 // Explicitly acquire and release the provider mutex so it can be held from |
| 84 // WillDraw to DidDraw. Since the compositor thread is in the middle of | 84 // WillDraw to DidDraw. Since the compositor thread is in the middle of |
| 85 // drawing, the layer will not be destroyed before DidDraw is called. | 85 // drawing, the layer will not be destroyed before DidDraw is called. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 external_resources.mailboxes[i], | 125 external_resources.mailboxes[i], |
| 126 SingleReleaseCallbackImpl::Create( | 126 SingleReleaseCallbackImpl::Create( |
| 127 external_resources.release_callbacks[i])); | 127 external_resources.release_callbacks[i])); |
| 128 frame_resources_.push_back(resource_id); | 128 frame_resources_.push_back(resource_id); |
| 129 } | 129 } |
| 130 | 130 |
| 131 return true; | 131 return true; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void VideoLayerImpl::AppendQuads(RenderPass* render_pass, | 134 void VideoLayerImpl::AppendQuads(RenderPass* render_pass, |
| 135 const Occlusion& occlusion_in_content_space, | |
| 136 AppendQuadsData* append_quads_data) { | 135 AppendQuadsData* append_quads_data) { |
| 137 DCHECK(frame_.get()); | 136 DCHECK(frame_.get()); |
| 138 | 137 |
| 139 gfx::Transform transform = draw_transform(); | 138 gfx::Transform transform = draw_transform(); |
| 140 gfx::Size rotated_size = content_bounds(); | 139 gfx::Size rotated_size = content_bounds(); |
| 141 | 140 |
| 142 switch (video_rotation_) { | 141 switch (video_rotation_) { |
| 143 case media::VIDEO_ROTATION_90: | 142 case media::VIDEO_ROTATION_90: |
| 144 rotated_size = gfx::Size(rotated_size.height(), rotated_size.width()); | 143 rotated_size = gfx::Size(rotated_size.height(), rotated_size.width()); |
| 145 transform.Rotate(90.0); | 144 transform.Rotate(90.0); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 165 | 164 |
| 166 AppendDebugBorderQuad( | 165 AppendDebugBorderQuad( |
| 167 render_pass, rotated_size, shared_quad_state, append_quads_data); | 166 render_pass, rotated_size, shared_quad_state, append_quads_data); |
| 168 | 167 |
| 169 gfx::Rect quad_rect(rotated_size); | 168 gfx::Rect quad_rect(rotated_size); |
| 170 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); | 169 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); |
| 171 gfx::Rect visible_rect = frame_->visible_rect(); | 170 gfx::Rect visible_rect = frame_->visible_rect(); |
| 172 gfx::Size coded_size = frame_->coded_size(); | 171 gfx::Size coded_size = frame_->coded_size(); |
| 173 | 172 |
| 174 Occlusion occlusion_in_video_space = | 173 Occlusion occlusion_in_video_space = |
| 175 occlusion_in_content_space.GetOcclusionWithGivenDrawTransform(transform); | 174 draw_properties() |
| 175 .occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( |
| 176 transform); |
| 176 gfx::Rect visible_quad_rect = | 177 gfx::Rect visible_quad_rect = |
| 177 occlusion_in_video_space.GetUnoccludedContentRect(quad_rect); | 178 occlusion_in_video_space.GetUnoccludedContentRect(quad_rect); |
| 178 if (visible_quad_rect.IsEmpty()) | 179 if (visible_quad_rect.IsEmpty()) |
| 179 return; | 180 return; |
| 180 | 181 |
| 181 // Pixels for macroblocked formats. | 182 // Pixels for macroblocked formats. |
| 182 const float tex_width_scale = | 183 const float tex_width_scale = |
| 183 static_cast<float>(visible_rect.width()) / coded_size.width(); | 184 static_cast<float>(visible_rect.width()) / coded_size.width(); |
| 184 const float tex_height_scale = | 185 const float tex_height_scale = |
| 185 static_cast<float>(visible_rect.height()) / coded_size.height(); | 186 static_cast<float>(visible_rect.height()) / coded_size.height(); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 void VideoLayerImpl::SetProviderClientImpl( | 364 void VideoLayerImpl::SetProviderClientImpl( |
| 364 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { | 365 scoped_refptr<VideoFrameProviderClientImpl> provider_client_impl) { |
| 365 provider_client_impl_ = provider_client_impl; | 366 provider_client_impl_ = provider_client_impl; |
| 366 } | 367 } |
| 367 | 368 |
| 368 const char* VideoLayerImpl::LayerTypeAsString() const { | 369 const char* VideoLayerImpl::LayerTypeAsString() const { |
| 369 return "cc::VideoLayerImpl"; | 370 return "cc::VideoLayerImpl"; |
| 370 } | 371 } |
| 371 | 372 |
| 372 } // namespace cc | 373 } // namespace cc |
| OLD | NEW |