OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layers/video_layer.h" |
6 | 6 |
7 #include "cc/layers/video_layer_impl.h" | 7 #include "cc/layers/video_layer_impl.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 // Video layer doesn't update any resources from the main thread side, | 29 // Video layer doesn't update any resources from the main thread side, |
30 // but repaint rects need to be sent to the VideoLayerImpl via commit. | 30 // but repaint rects need to be sent to the VideoLayerImpl via commit. |
31 // | 31 // |
32 // This is the inefficient legacy redraw path for videos. It's better to | 32 // This is the inefficient legacy redraw path for videos. It's better to |
33 // communicate this directly to the VideoLayerImpl. | 33 // communicate this directly to the VideoLayerImpl. |
34 updated |= !update_rect_.IsEmpty(); | 34 updated |= !update_rect_.IsEmpty(); |
35 | 35 |
36 return updated; | 36 return updated; |
37 } | 37 } |
38 | 38 |
| 39 void VideoLayer::PushPropertiesTo(LayerImpl* impl) { |
| 40 Layer::PushPropertiesTo(impl); |
| 41 gfx::Transform transform = impl->transform(); |
| 42 bool transform_is_invertible = impl->transform_is_invertible(); |
| 43 gfx::Size content_bounds = impl->content_bounds(); |
| 44 gfx::Size bounds = impl->bounds(); |
| 45 |
| 46 // As blink is provided the bounds of the video layer post rotation |
| 47 // for laying out the page, video layer impl's bounds must be transposed |
| 48 // for 90 or 270 degree rotations. |
| 49 switch (video_rotation_) { |
| 50 case media::VIDEO_ROTATION_90: |
| 51 transform.Rotate(90.0); |
| 52 transform.Translate(0.0, -content_bounds.width()); |
| 53 content_bounds = |
| 54 gfx::Size(content_bounds.height(), content_bounds.width()); |
| 55 bounds = gfx::Size(bounds.height(), bounds.width()); |
| 56 break; |
| 57 case media::VIDEO_ROTATION_180: |
| 58 transform.Rotate(180.0); |
| 59 transform.Translate(-content_bounds.width(), -content_bounds.height()); |
| 60 break; |
| 61 case media::VIDEO_ROTATION_270: |
| 62 transform.Rotate(270.0); |
| 63 transform.Translate(-content_bounds.height(), 0); |
| 64 content_bounds = |
| 65 gfx::Size(content_bounds.height(), content_bounds.width()); |
| 66 bounds = gfx::Size(bounds.height(), bounds.width()); |
| 67 case media::VIDEO_ROTATION_0: |
| 68 break; |
| 69 } |
| 70 |
| 71 impl->SetBounds(bounds); |
| 72 impl->draw_properties().content_bounds = content_bounds; |
| 73 impl->SetTransformAndInvertibility(transform, transform_is_invertible); |
| 74 } |
| 75 |
39 } // namespace cc | 76 } // namespace cc |
OLD | NEW |