Revert 161482 - [cc] Store CCLayerImpls as scoped_ptrs
[chromium-blink-merge.git] / cc / IOSurfaceLayerChromium.cpp
blob7b242fd7130f53713a555de6c3ac79a99f1b00de
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.
5 #include "config.h"
7 #if USE(ACCELERATED_COMPOSITING)
9 #include "IOSurfaceLayerChromium.h"
11 #include "CCIOSurfaceLayerImpl.h"
13 namespace cc {
15 scoped_refptr<IOSurfaceLayerChromium> IOSurfaceLayerChromium::create()
17 return make_scoped_refptr(new IOSurfaceLayerChromium());
20 IOSurfaceLayerChromium::IOSurfaceLayerChromium()
21 : LayerChromium()
22 , m_ioSurfaceId(0)
26 IOSurfaceLayerChromium::~IOSurfaceLayerChromium()
30 void IOSurfaceLayerChromium::setIOSurfaceProperties(uint32_t ioSurfaceId, const IntSize& size)
32 m_ioSurfaceId = ioSurfaceId;
33 m_ioSurfaceSize = size;
34 setNeedsCommit();
37 PassOwnPtr<CCLayerImpl> IOSurfaceLayerChromium::createCCLayerImpl()
39 return CCIOSurfaceLayerImpl::create(m_layerId);
42 bool IOSurfaceLayerChromium::drawsContent() const
44 return m_ioSurfaceId && LayerChromium::drawsContent();
47 void IOSurfaceLayerChromium::pushPropertiesTo(CCLayerImpl* layer)
49 LayerChromium::pushPropertiesTo(layer);
51 CCIOSurfaceLayerImpl* textureLayer = static_cast<CCIOSurfaceLayerImpl*>(layer);
52 textureLayer->setIOSurfaceProperties(m_ioSurfaceId, m_ioSurfaceSize);
56 #endif // USE(ACCELERATED_COMPOSITING)