| 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 "cc/heads_up_display_layer.h" | 5 #include "cc/heads_up_display_layer.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "cc/heads_up_display_layer_impl.h" | 8 #include "cc/heads_up_display_layer_impl.h" |
| 9 #include "cc/layer_tree_host.h" | 9 #include "cc/layer_tree_host.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create() | 13 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create() |
| 14 { | 14 { |
| 15 return make_scoped_refptr(new HeadsUpDisplayLayer()); | 15 return make_scoped_refptr(new HeadsUpDisplayLayer()); |
| 16 } | 16 } |
| 17 | 17 |
| 18 HeadsUpDisplayLayer::HeadsUpDisplayLayer() | 18 HeadsUpDisplayLayer::HeadsUpDisplayLayer() |
| 19 : Layer() | 19 : Layer() |
| 20 , m_showFPSCounter(false) | 20 , m_showFPSCounter(false) |
| 21 , m_hasFontAtlas(false) |
| 21 { | 22 { |
| 22 setBounds(gfx::Size(256, 128)); | 23 setBounds(gfx::Size(256, 128)); |
| 23 } | 24 } |
| 24 | 25 |
| 25 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() | 26 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() |
| 26 { | 27 { |
| 27 } | 28 } |
| 28 | 29 |
| 29 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*,
RenderingStats&) | 30 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*,
RenderingStats&) |
| 30 { | 31 { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 50 | 51 |
| 51 bool HeadsUpDisplayLayer::drawsContent() const | 52 bool HeadsUpDisplayLayer::drawsContent() const |
| 52 { | 53 { |
| 53 return true; | 54 return true; |
| 54 } | 55 } |
| 55 | 56 |
| 56 void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) | 57 void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) |
| 57 { | 58 { |
| 58 m_fontAtlas = fontAtlas.Pass(); | 59 m_fontAtlas = fontAtlas.Pass(); |
| 59 setNeedsCommit(); | 60 setNeedsCommit(); |
| 61 m_hasFontAtlas = true; |
| 60 } | 62 } |
| 61 | 63 |
| 62 void HeadsUpDisplayLayer::setShowFPSCounter(bool show) | 64 void HeadsUpDisplayLayer::setShowFPSCounter(bool show) |
| 63 { | 65 { |
| 64 m_showFPSCounter = show; | 66 m_showFPSCounter = show; |
| 65 setNeedsCommit(); | 67 setNeedsCommit(); |
| 66 } | 68 } |
| 67 | 69 |
| 68 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl() | 70 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl() |
| 69 { | 71 { |
| 70 return HeadsUpDisplayLayerImpl::create(m_layerId).PassAs<LayerImpl>(); | 72 return HeadsUpDisplayLayerImpl::create(m_layerId).PassAs<LayerImpl>(); |
| 71 } | 73 } |
| 72 | 74 |
| 73 void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl) | 75 void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl) |
| 74 { | 76 { |
| 75 Layer::pushPropertiesTo(layerImpl); | 77 Layer::pushPropertiesTo(layerImpl); |
| 76 | 78 |
| 77 HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl*
>(layerImpl); | 79 HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl*
>(layerImpl); |
| 78 hudLayerImpl->setShowFPSCounter(m_showFPSCounter); | 80 hudLayerImpl->setShowFPSCounter(m_showFPSCounter); |
| 79 | 81 |
| 80 if (m_fontAtlas.get()) | 82 if (m_fontAtlas.get()) |
| 81 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass()); | 83 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass()); |
| 82 } | 84 } |
| 83 | 85 |
| 84 } // namespace cc | 86 } // namespace cc |
| OLD | NEW |