[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 5 | #include "cc/layers/video_layer.h" |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 6 | |
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 7 | #include "cc/layers/video_layer_impl.h" |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 8 | |
[email protected] | 9c88e56 | 2012-09-14 22:21:30 | [diff] [blame] | 9 | namespace cc { |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 10 | |
[email protected] | f78c3e8 | 2014-08-08 01:24:47 | [diff] [blame] | 11 | scoped_refptr<VideoLayer> VideoLayer::Create( |
12 | VideoFrameProvider* provider, | ||||
13 | media::VideoRotation video_rotation) { | ||||
loyso | 0940d41 | 2016-03-14 01:30:31 | [diff] [blame] | 14 | return make_scoped_refptr(new VideoLayer(provider, video_rotation)); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 15 | } |
16 | |||||
loyso | 0940d41 | 2016-03-14 01:30:31 | [diff] [blame] | 17 | VideoLayer::VideoLayer(VideoFrameProvider* provider, |
[email protected] | f78c3e8 | 2014-08-08 01:24:47 | [diff] [blame] | 18 | media::VideoRotation video_rotation) |
loyso | 0940d41 | 2016-03-14 01:30:31 | [diff] [blame] | 19 | : provider_(provider), video_rotation_(video_rotation) { |
[email protected] | 5065780 | 2013-03-13 06:43:35 | [diff] [blame] | 20 | DCHECK(provider_); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 21 | } |
22 | |||||
[email protected] | 5065780 | 2013-03-13 06:43:35 | [diff] [blame] | 23 | VideoLayer::~VideoLayer() {} |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 24 | |
danakj | 60bc3bc | 2016-04-09 00:24:48 | [diff] [blame^] | 25 | std::unique_ptr<LayerImpl> VideoLayer::CreateLayerImpl( |
26 | LayerTreeImpl* tree_impl) { | ||||
danakj | a04855a | 2015-11-18 20:39:10 | [diff] [blame] | 27 | return VideoLayerImpl::Create(tree_impl, id(), provider_, video_rotation_); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 28 | } |
29 | |||||
danakj | 5f46636a | 2015-06-19 00:01:40 | [diff] [blame] | 30 | bool VideoLayer::Update() { |
31 | bool updated = Layer::Update(); | ||||
[email protected] | c50b99729 | 2013-08-03 18:44:30 | [diff] [blame] | 32 | |
[email protected] | 41084bf | 2013-08-02 00:36:33 | [diff] [blame] | 33 | // Video layer doesn't update any resources from the main thread side, |
34 | // but repaint rects need to be sent to the VideoLayerImpl via commit. | ||||
35 | // | ||||
36 | // This is the inefficient legacy redraw path for videos. It's better to | ||||
37 | // communicate this directly to the VideoLayerImpl. | ||||
[email protected] | c50b99729 | 2013-08-03 18:44:30 | [diff] [blame] | 38 | updated |= !update_rect_.IsEmpty(); |
39 | |||||
40 | return updated; | ||||
[email protected] | 41084bf | 2013-08-02 00:36:33 | [diff] [blame] | 41 | } |
42 | |||||
[email protected] | 59cb7b35 | 2012-10-30 06:45:48 | [diff] [blame] | 43 | } // namespace cc |