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( | 11 scoped_refptr<VideoLayer> VideoLayer::Create( |
12 const LayerSettings& settings, | 12 const LayerSettings& settings, |
13 VideoFrameProvider* provider, | 13 VideoFrameProvider* provider, |
14 media::VideoRotation video_rotation) { | 14 media::VideoRotation video_rotation) { |
15 return make_scoped_refptr(new VideoLayer(settings, provider, video_rotation)); | 15 return make_scoped_refptr(new VideoLayer(settings, provider, video_rotation)); |
16 } | 16 } |
17 | 17 |
18 VideoLayer::VideoLayer(const LayerSettings& settings, | 18 VideoLayer::VideoLayer(const LayerSettings& settings, |
19 VideoFrameProvider* provider, | 19 VideoFrameProvider* provider, |
20 media::VideoRotation video_rotation) | 20 media::VideoRotation video_rotation) |
21 : Layer(settings), provider_(provider), video_rotation_(video_rotation) { | 21 : Layer(settings), provider_(provider), video_rotation_(video_rotation) { |
22 DCHECK(provider_); | 22 DCHECK(provider_); |
23 } | 23 } |
24 | 24 |
25 VideoLayer::~VideoLayer() {} | 25 VideoLayer::~VideoLayer() {} |
26 | 26 |
27 scoped_ptr<LayerImpl> VideoLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 27 scoped_ptr<LayerImpl> VideoLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
28 scoped_ptr<VideoLayerImpl> impl = | 28 return VideoLayerImpl::Create(tree_impl, id(), provider_, video_rotation_); |
29 VideoLayerImpl::Create(tree_impl, id(), provider_, video_rotation_); | |
30 return impl.Pass(); | |
31 } | 29 } |
32 | 30 |
33 bool VideoLayer::Update() { | 31 bool VideoLayer::Update() { |
34 bool updated = Layer::Update(); | 32 bool updated = Layer::Update(); |
35 | 33 |
36 // Video layer doesn't update any resources from the main thread side, | 34 // Video layer doesn't update any resources from the main thread side, |
37 // but repaint rects need to be sent to the VideoLayerImpl via commit. | 35 // but repaint rects need to be sent to the VideoLayerImpl via commit. |
38 // | 36 // |
39 // This is the inefficient legacy redraw path for videos. It's better to | 37 // This is the inefficient legacy redraw path for videos. It's better to |
40 // communicate this directly to the VideoLayerImpl. | 38 // communicate this directly to the VideoLayerImpl. |
41 updated |= !update_rect_.IsEmpty(); | 39 updated |= !update_rect_.IsEmpty(); |
42 | 40 |
43 return updated; | 41 return updated; |
44 } | 42 } |
45 | 43 |
46 } // namespace cc | 44 } // namespace cc |
OLD | NEW |