| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 case media::VIDEO_ROTATION_270: | 154 case media::VIDEO_ROTATION_270: |
| 155 rotated_size = gfx::Size(rotated_size.height(), rotated_size.width()); | 155 rotated_size = gfx::Size(rotated_size.height(), rotated_size.width()); |
| 156 transform.Rotate(270.0); | 156 transform.Rotate(270.0); |
| 157 transform.Translate(-rotated_size.width(), 0); | 157 transform.Translate(-rotated_size.width(), 0); |
| 158 case media::VIDEO_ROTATION_0: | 158 case media::VIDEO_ROTATION_0: |
| 159 break; | 159 break; |
| 160 } | 160 } |
| 161 | 161 |
| 162 SharedQuadState* shared_quad_state = | 162 SharedQuadState* shared_quad_state = |
| 163 render_pass->CreateAndAppendSharedQuadState(); | 163 render_pass->CreateAndAppendSharedQuadState(); |
| 164 shared_quad_state->SetAll(transform, rotated_size, visible_content_rect(), | 164 shared_quad_state->SetAll(transform, rotated_size, visible_layer_rect(), |
| 165 clip_rect(), is_clipped(), draw_opacity(), | 165 clip_rect(), is_clipped(), draw_opacity(), |
| 166 draw_blend_mode(), sorting_context_id()); | 166 draw_blend_mode(), sorting_context_id()); |
| 167 | 167 |
| 168 AppendDebugBorderQuad( | 168 AppendDebugBorderQuad( |
| 169 render_pass, rotated_size, shared_quad_state, append_quads_data); | 169 render_pass, rotated_size, shared_quad_state, append_quads_data); |
| 170 | 170 |
| 171 gfx::Rect quad_rect(rotated_size); | 171 gfx::Rect quad_rect(rotated_size); |
| 172 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); | 172 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect()); |
| 173 gfx::Rect visible_rect = frame_->visible_rect(); | 173 gfx::Rect visible_rect = frame_->visible_rect(); |
| 174 gfx::Size coded_size = frame_->coded_size(); | 174 gfx::Size coded_size = frame_->coded_size(); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 resource_provider->DeleteResource(frame_resources_[i].id); | 382 resource_provider->DeleteResource(frame_resources_[i].id); |
| 383 frame_resources_.clear(); | 383 frame_resources_.clear(); |
| 384 } | 384 } |
| 385 | 385 |
| 386 provider_client_impl_->PutCurrentFrame(); | 386 provider_client_impl_->PutCurrentFrame(); |
| 387 frame_ = nullptr; | 387 frame_ = nullptr; |
| 388 | 388 |
| 389 provider_client_impl_->ReleaseLock(); | 389 provider_client_impl_->ReleaseLock(); |
| 390 } | 390 } |
| 391 | 391 |
| 392 SimpleEnclosedRegion VideoLayerImpl::VisibleContentOpaqueRegion() const { | 392 SimpleEnclosedRegion VideoLayerImpl::VisibleOpaqueRegion() const { |
| 393 // If we don't have a frame yet, then we don't have an opaque region. | 393 // If we don't have a frame yet, then we don't have an opaque region. |
| 394 if (!provider_client_impl_->HasCurrentFrame()) | 394 if (!provider_client_impl_->HasCurrentFrame()) |
| 395 return SimpleEnclosedRegion(); | 395 return SimpleEnclosedRegion(); |
| 396 return LayerImpl::VisibleContentOpaqueRegion(); | 396 return LayerImpl::VisibleOpaqueRegion(); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void VideoLayerImpl::ReleaseResources() { | 399 void VideoLayerImpl::ReleaseResources() { |
| 400 updater_ = nullptr; | 400 updater_ = nullptr; |
| 401 } | 401 } |
| 402 | 402 |
| 403 void VideoLayerImpl::SetNeedsRedraw() { | 403 void VideoLayerImpl::SetNeedsRedraw() { |
| 404 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); | 404 SetUpdateRect(gfx::UnionRects(update_rect(), gfx::Rect(bounds()))); |
| 405 layer_tree_impl()->SetNeedsRedraw(); | 405 layer_tree_impl()->SetNeedsRedraw(); |
| 406 } | 406 } |
| 407 | 407 |
| 408 const char* VideoLayerImpl::LayerTypeAsString() const { | 408 const char* VideoLayerImpl::LayerTypeAsString() const { |
| 409 return "cc::VideoLayerImpl"; | 409 return "cc::VideoLayerImpl"; |
| 410 } | 410 } |
| 411 | 411 |
| 412 } // namespace cc | 412 } // namespace cc |
| OLD | NEW |