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