diff options
Diffstat (limited to 'cc/io_surface_layer.cc')
-rw-r--r-- | cc/io_surface_layer.cc | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/cc/io_surface_layer.cc b/cc/io_surface_layer.cc new file mode 100644 index 0000000..fe6d39a --- /dev/null +++ b/cc/io_surface_layer.cc @@ -0,0 +1,56 @@ +// Copyright 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "config.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "IOSurfaceLayerChromium.h" + +#include "CCIOSurfaceLayerImpl.h" + +namespace cc { + +scoped_refptr<IOSurfaceLayerChromium> IOSurfaceLayerChromium::create() +{ + return make_scoped_refptr(new IOSurfaceLayerChromium()); +} + +IOSurfaceLayerChromium::IOSurfaceLayerChromium() + : LayerChromium() + , m_ioSurfaceId(0) +{ +} + +IOSurfaceLayerChromium::~IOSurfaceLayerChromium() +{ +} + +void IOSurfaceLayerChromium::setIOSurfaceProperties(uint32_t ioSurfaceId, const IntSize& size) +{ + m_ioSurfaceId = ioSurfaceId; + m_ioSurfaceSize = size; + setNeedsCommit(); +} + +scoped_ptr<CCLayerImpl> IOSurfaceLayerChromium::createCCLayerImpl() +{ + return CCIOSurfaceLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); +} + +bool IOSurfaceLayerChromium::drawsContent() const +{ + return m_ioSurfaceId && LayerChromium::drawsContent(); +} + +void IOSurfaceLayerChromium::pushPropertiesTo(CCLayerImpl* layer) +{ + LayerChromium::pushPropertiesTo(layer); + + CCIOSurfaceLayerImpl* textureLayer = static_cast<CCIOSurfaceLayerImpl*>(layer); + textureLayer->setIOSurfaceProperties(m_ioSurfaceId, m_ioSurfaceSize); +} + +} +#endif // USE(ACCELERATED_COMPOSITING) |