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_hasFontAtlas(false) |
20 { | 21 { |
21 setBounds(gfx::Size(256, 128)); | 22 setBounds(gfx::Size(256, 128)); |
22 } | 23 } |
23 | 24 |
24 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() | 25 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() |
25 { | 26 { |
26 } | 27 } |
27 | 28 |
28 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*,
RenderingStats&) | 29 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*,
RenderingStats&) |
29 { | 30 { |
(...skipping 18 matching lines...) Expand all Loading... |
48 } | 49 } |
49 | 50 |
50 bool HeadsUpDisplayLayer::drawsContent() const | 51 bool HeadsUpDisplayLayer::drawsContent() const |
51 { | 52 { |
52 return true; | 53 return true; |
53 } | 54 } |
54 | 55 |
55 void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) | 56 void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) |
56 { | 57 { |
57 m_fontAtlas = fontAtlas.Pass(); | 58 m_fontAtlas = fontAtlas.Pass(); |
58 setNeedsCommit(); | 59 m_hasFontAtlas = true; |
59 } | 60 } |
60 | 61 |
61 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl() | 62 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl() |
62 { | 63 { |
63 return HeadsUpDisplayLayerImpl::create(m_layerId).PassAs<LayerImpl>(); | 64 return HeadsUpDisplayLayerImpl::create(m_layerId).PassAs<LayerImpl>(); |
64 } | 65 } |
65 | 66 |
66 void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl) | 67 void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl) |
67 { | 68 { |
68 Layer::pushPropertiesTo(layerImpl); | 69 Layer::pushPropertiesTo(layerImpl); |
69 | 70 |
70 if (!m_fontAtlas) | 71 if (!m_fontAtlas) |
71 return; | 72 return; |
72 | 73 |
73 HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl*
>(layerImpl); | 74 HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl*
>(layerImpl); |
74 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass()); | 75 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass()); |
75 } | 76 } |
76 | 77 |
77 } // namespace cc | 78 } // namespace cc |
OLD | NEW |