| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/heads_up_display_layer.h" | 7 #include "cc/heads_up_display_layer.h" |
| 8 | 8 |
| 9 #include "CCHeadsUpDisplayLayerImpl.h" | 9 #include "CCHeadsUpDisplayLayerImpl.h" |
| 10 #include "CCLayerTreeHost.h" | 10 #include "CCLayerTreeHost.h" |
| 11 #include "TraceEvent.h" | 11 #include "TraceEvent.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 scoped_refptr<HeadsUpDisplayLayerChromium> HeadsUpDisplayLayerChromium::create() | 15 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create() |
| 16 { | 16 { |
| 17 return make_scoped_refptr(new HeadsUpDisplayLayerChromium()); | 17 return make_scoped_refptr(new HeadsUpDisplayLayer()); |
| 18 } | 18 } |
| 19 | 19 |
| 20 HeadsUpDisplayLayerChromium::HeadsUpDisplayLayerChromium() | 20 HeadsUpDisplayLayer::HeadsUpDisplayLayer() |
| 21 : LayerChromium() | 21 : Layer() |
| 22 { | 22 { |
| 23 | 23 |
| 24 setBounds(IntSize(512, 128)); | 24 setBounds(IntSize(512, 128)); |
| 25 } | 25 } |
| 26 | 26 |
| 27 HeadsUpDisplayLayerChromium::~HeadsUpDisplayLayerChromium() | 27 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() |
| 28 { | 28 { |
| 29 } | 29 } |
| 30 | 30 |
| 31 void HeadsUpDisplayLayerChromium::update(CCTextureUpdateQueue&, const CCOcclusio
nTracker*, CCRenderingStats&) | 31 void HeadsUpDisplayLayer::update(TextureUpdateQueue&, const OcclusionTracker*, R
enderingStats&) |
| 32 { | 32 { |
| 33 const CCLayerTreeSettings& settings = layerTreeHost()->settings(); | 33 const LayerTreeSettings& settings = layerTreeHost()->settings(); |
| 34 int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize; | 34 int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize; |
| 35 | 35 |
| 36 IntSize bounds; | 36 IntSize bounds; |
| 37 if (settings.showPlatformLayerTree || settings.showDebugRects()) { | 37 if (settings.showPlatformLayerTree || settings.showDebugRects()) { |
| 38 bounds.setWidth(std::min(maxTextureSize, layerTreeHost()->deviceViewport
Size().width())); | 38 bounds.setWidth(std::min(maxTextureSize, layerTreeHost()->deviceViewport
Size().width())); |
| 39 bounds.setHeight(std::min(maxTextureSize, layerTreeHost()->deviceViewpor
tSize().height())); | 39 bounds.setHeight(std::min(maxTextureSize, layerTreeHost()->deviceViewpor
tSize().height())); |
| 40 } else { | 40 } else { |
| 41 bounds.setWidth(512); | 41 bounds.setWidth(512); |
| 42 bounds.setHeight(128); | 42 bounds.setHeight(128); |
| 43 } | 43 } |
| 44 | 44 |
| 45 setBounds(bounds); | 45 setBounds(bounds); |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool HeadsUpDisplayLayerChromium::drawsContent() const | 48 bool HeadsUpDisplayLayer::drawsContent() const |
| 49 { | 49 { |
| 50 return true; | 50 return true; |
| 51 } | 51 } |
| 52 | 52 |
| 53 void HeadsUpDisplayLayerChromium::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas
) | 53 void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) |
| 54 { | 54 { |
| 55 m_fontAtlas = fontAtlas.Pass(); | 55 m_fontAtlas = fontAtlas.Pass(); |
| 56 setNeedsCommit(); | 56 setNeedsCommit(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 scoped_ptr<CCLayerImpl> HeadsUpDisplayLayerChromium::createCCLayerImpl() | 59 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl() |
| 60 { | 60 { |
| 61 return CCHeadsUpDisplayLayerImpl::create(m_layerId).PassAs<CCLayerImpl>(); | 61 return HeadsUpDisplayLayerImpl::create(m_layerId).PassAs<LayerImpl>(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void HeadsUpDisplayLayerChromium::pushPropertiesTo(CCLayerImpl* layerImpl) | 64 void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl) |
| 65 { | 65 { |
| 66 LayerChromium::pushPropertiesTo(layerImpl); | 66 Layer::pushPropertiesTo(layerImpl); |
| 67 | 67 |
| 68 if (!m_fontAtlas.get()) | 68 if (!m_fontAtlas.get()) |
| 69 return; | 69 return; |
| 70 | 70 |
| 71 CCHeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<CCHeadsUpDisplayLayerI
mpl*>(layerImpl); | 71 HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl*
>(layerImpl); |
| 72 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass()); | 72 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 } | 75 } |
| OLD | NEW |