[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 1 | // Copyright 2012 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] | a8461d8 | 2012-10-16 21:11:14 | [diff] [blame] | 5 | #include "cc/io_surface_layer.h" |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 6 | |
[email protected] | d50c686 | 2012-10-23 02:08:31 | [diff] [blame] | 7 | #include "cc/io_surface_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] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 11 | scoped_refptr<IOSurfaceLayer> IOSurfaceLayer::create() |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 12 | { |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 13 | return make_scoped_refptr(new IOSurfaceLayer()); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 14 | } |
15 | |||||
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 16 | IOSurfaceLayer::IOSurfaceLayer() |
17 | : Layer() | ||||
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 18 | , m_ioSurfaceId(0) |
19 | { | ||||
20 | } | ||||
21 | |||||
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 22 | IOSurfaceLayer::~IOSurfaceLayer() |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 23 | { |
24 | } | ||||
25 | |||||
[email protected] | d455d55 | 2012-11-02 00:19:06 | [diff] [blame] | 26 | void IOSurfaceLayer::setIOSurfaceProperties(uint32_t ioSurfaceId, const gfx::Size& size) |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 27 | { |
28 | m_ioSurfaceId = ioSurfaceId; | ||||
29 | m_ioSurfaceSize = size; | ||||
30 | setNeedsCommit(); | ||||
31 | } | ||||
32 | |||||
[email protected] | 8bef4057 | 2012-12-11 21:38:08 | [diff] [blame] | 33 | scoped_ptr<LayerImpl> IOSurfaceLayer::createLayerImpl(LayerTreeImpl* treeImpl) |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 34 | { |
[email protected] | 8bef4057 | 2012-12-11 21:38:08 | [diff] [blame] | 35 | return IOSurfaceLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl>(); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 36 | } |
37 | |||||
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 38 | bool IOSurfaceLayer::drawsContent() const |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 39 | { |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 40 | return m_ioSurfaceId && Layer::drawsContent(); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 41 | } |
42 | |||||
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 43 | void IOSurfaceLayer::pushPropertiesTo(LayerImpl* layer) |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 44 | { |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 45 | Layer::pushPropertiesTo(layer); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 46 | |
[email protected] | d455d55 | 2012-11-02 00:19:06 | [diff] [blame] | 47 | IOSurfaceLayerImpl* ioSurfaceLayer = static_cast<IOSurfaceLayerImpl*>(layer); |
48 | ioSurfaceLayer->setIOSurfaceProperties(m_ioSurfaceId, m_ioSurfaceSize); | ||||
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 49 | } |
50 | |||||
[email protected] | bc5e77c | 2012-11-05 20:00:49 | [diff] [blame] | 51 | } // namespace cc |