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 |
11 scoped_refptr<VideoLayer> VideoLayer::Create(VideoFrameProvider* provider) { | 11 scoped_refptr<VideoLayer> VideoLayer::Create(VideoFrameProvider* provider) { |
danakj
2014/07/17 20:19:05
Do we need to keep 2 Create methods?
| |
12 return make_scoped_refptr(new VideoLayer(provider)); | 12 return make_scoped_refptr(new VideoLayer(provider, media::VIDEO_ROTATION_0)); |
13 } | 13 } |
14 | 14 |
15 VideoLayer::VideoLayer(VideoFrameProvider* provider) : provider_(provider) { | 15 scoped_refptr<VideoLayer> VideoLayer::Create( |
16 VideoFrameProvider* provider, | |
17 media::VideoRotation video_rotation) { | |
18 return make_scoped_refptr(new VideoLayer(provider, video_rotation)); | |
19 } | |
20 | |
21 VideoLayer::VideoLayer(VideoFrameProvider* provider, | |
22 media::VideoRotation video_rotation) | |
23 : provider_(provider), video_rotation_(video_rotation) { | |
16 DCHECK(provider_); | 24 DCHECK(provider_); |
17 } | 25 } |
18 | 26 |
19 VideoLayer::~VideoLayer() {} | 27 VideoLayer::~VideoLayer() {} |
20 | 28 |
21 scoped_ptr<LayerImpl> VideoLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 29 scoped_ptr<LayerImpl> VideoLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
22 return VideoLayerImpl::Create(tree_impl, id(), provider_).PassAs<LayerImpl>(); | 30 scoped_ptr<VideoLayerImpl> impl = |
31 VideoLayerImpl::Create(tree_impl, id(), provider_); | |
danakj
2014/07/17 20:19:05
Sorry to backtrack, we don't normally have propert
| |
32 return impl.PassAs<LayerImpl>(); | |
23 } | 33 } |
24 | 34 |
25 bool VideoLayer::Update(ResourceUpdateQueue* queue, | 35 bool VideoLayer::Update(ResourceUpdateQueue* queue, |
26 const OcclusionTracker<Layer>* occlusion) { | 36 const OcclusionTracker<Layer>* occlusion) { |
27 bool updated = Layer::Update(queue, occlusion); | 37 bool updated = Layer::Update(queue, occlusion); |
28 | 38 |
29 // Video layer doesn't update any resources from the main thread side, | 39 // 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. | 40 // but repaint rects need to be sent to the VideoLayerImpl via commit. |
31 // | 41 // |
32 // This is the inefficient legacy redraw path for videos. It's better to | 42 // This is the inefficient legacy redraw path for videos. It's better to |
33 // communicate this directly to the VideoLayerImpl. | 43 // communicate this directly to the VideoLayerImpl. |
34 updated |= !update_rect_.IsEmpty(); | 44 updated |= !update_rect_.IsEmpty(); |
35 | 45 |
36 return updated; | 46 return updated; |
37 } | 47 } |
38 | 48 |
49 void VideoLayer::PushPropertiesTo(LayerImpl* layer) { | |
50 Layer::PushPropertiesTo(layer); | |
51 | |
52 VideoLayerImpl* other = static_cast<VideoLayerImpl*>(layer); | |
53 other->set_video_rotation(video_rotation_); | |
54 } | |
55 | |
39 } // namespace cc | 56 } // namespace cc |
OLD | NEW |