blob: 96cfc1608b32f4d8e795930aa5f3188311327e93 [file] [log] [blame]
[email protected]94f206c12012-08-25 00:09:141// 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]a8461d82012-10-16 21:11:145#include "cc/io_surface_layer.h"
[email protected]94f206c12012-08-25 00:09:146
[email protected]d50c6862012-10-23 02:08:317#include "cc/io_surface_layer_impl.h"
[email protected]94f206c12012-08-25 00:09:148
[email protected]9c88e562012-09-14 22:21:309namespace cc {
[email protected]94f206c12012-08-25 00:09:1410
[email protected]96baf3e2012-10-22 23:09:5511scoped_refptr<IOSurfaceLayer> IOSurfaceLayer::create()
[email protected]94f206c12012-08-25 00:09:1412{
[email protected]96baf3e2012-10-22 23:09:5513 return make_scoped_refptr(new IOSurfaceLayer());
[email protected]94f206c12012-08-25 00:09:1414}
15
[email protected]96baf3e2012-10-22 23:09:5516IOSurfaceLayer::IOSurfaceLayer()
17 : Layer()
[email protected]94f206c12012-08-25 00:09:1418 , m_ioSurfaceId(0)
19{
20}
21
[email protected]96baf3e2012-10-22 23:09:5522IOSurfaceLayer::~IOSurfaceLayer()
[email protected]94f206c12012-08-25 00:09:1423{
24}
25
[email protected]d455d552012-11-02 00:19:0626void IOSurfaceLayer::setIOSurfaceProperties(uint32_t ioSurfaceId, const gfx::Size& size)
[email protected]94f206c12012-08-25 00:09:1427{
28 m_ioSurfaceId = ioSurfaceId;
29 m_ioSurfaceSize = size;
30 setNeedsCommit();
31}
32
[email protected]8bef40572012-12-11 21:38:0833scoped_ptr<LayerImpl> IOSurfaceLayer::createLayerImpl(LayerTreeImpl* treeImpl)
[email protected]94f206c12012-08-25 00:09:1434{
[email protected]8bef40572012-12-11 21:38:0835 return IOSurfaceLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl>();
[email protected]94f206c12012-08-25 00:09:1436}
37
[email protected]96baf3e2012-10-22 23:09:5538bool IOSurfaceLayer::drawsContent() const
[email protected]94f206c12012-08-25 00:09:1439{
[email protected]96baf3e2012-10-22 23:09:5540 return m_ioSurfaceId && Layer::drawsContent();
[email protected]94f206c12012-08-25 00:09:1441}
42
[email protected]96baf3e2012-10-22 23:09:5543void IOSurfaceLayer::pushPropertiesTo(LayerImpl* layer)
[email protected]94f206c12012-08-25 00:09:1444{
[email protected]96baf3e2012-10-22 23:09:5545 Layer::pushPropertiesTo(layer);
[email protected]94f206c12012-08-25 00:09:1446
[email protected]d455d552012-11-02 00:19:0647 IOSurfaceLayerImpl* ioSurfaceLayer = static_cast<IOSurfaceLayerImpl*>(layer);
48 ioSurfaceLayer->setIOSurfaceProperties(m_ioSurfaceId, m_ioSurfaceSize);
[email protected]94f206c12012-08-25 00:09:1449}
50
[email protected]bc5e77c2012-11-05 20:00:4951} // namespace cc