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_impl.h" | 5 #include "cc/heads_up_display_layer_impl.h" |
6 | 6 |
7 #include "base/string_split.h" | 7 #include "base/string_split.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "cc/debug_colors.h" | 9 #include "cc/debug_colors.h" |
10 #include "cc/debug_rect_history.h" | 10 #include "cc/debug_rect_history.h" |
11 #include "cc/font_atlas.h" | |
12 #include "cc/frame_rate_counter.h" | 11 #include "cc/frame_rate_counter.h" |
13 #include "cc/layer_tree_impl.h" | 12 #include "cc/layer_tree_impl.h" |
14 #include "cc/memory_history.h" | 13 #include "cc/memory_history.h" |
15 #include "cc/paint_time_counter.h" | 14 #include "cc/paint_time_counter.h" |
16 #include "cc/quad_sink.h" | 15 #include "cc/quad_sink.h" |
17 #include "cc/renderer.h" | 16 #include "cc/renderer.h" |
18 #include "cc/texture_draw_quad.h" | 17 #include "cc/texture_draw_quad.h" |
19 #include "cc/tile_manager.h" | 18 #include "cc/tile_manager.h" |
20 #include "skia/ext/platform_canvas.h" | 19 #include "skia/ext/platform_canvas.h" |
21 #include "skia/ext/platform_canvas.h" | 20 #include "skia/ext/platform_canvas.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 78 |
80 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() | 79 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() |
81 { | 80 { |
82 } | 81 } |
83 | 82 |
84 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::createLayerImpl(LayerTreeImpl* tr
eeImpl) | 83 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::createLayerImpl(LayerTreeImpl* tr
eeImpl) |
85 { | 84 { |
86 return HeadsUpDisplayLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>(); | 85 return HeadsUpDisplayLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>(); |
87 } | 86 } |
88 | 87 |
89 void HeadsUpDisplayLayerImpl::pushPropertiesTo(LayerImpl* layerImpl) | |
90 { | |
91 LayerImpl::pushPropertiesTo(layerImpl); | |
92 | |
93 if (!m_fontAtlas) | |
94 return; | |
95 | |
96 HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl*
>(layerImpl); | |
97 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass()); | |
98 } | |
99 | |
100 void HeadsUpDisplayLayerImpl::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) | |
101 { | |
102 m_fontAtlas = fontAtlas.Pass(); | |
103 } | |
104 | |
105 void HeadsUpDisplayLayerImpl::willDraw(ResourceProvider* resourceProvider) | 88 void HeadsUpDisplayLayerImpl::willDraw(ResourceProvider* resourceProvider) |
106 { | 89 { |
107 LayerImpl::willDraw(resourceProvider); | 90 LayerImpl::willDraw(resourceProvider); |
108 | 91 |
109 if (!m_hudTexture) | 92 if (!m_hudTexture) |
110 m_hudTexture = ScopedResource::create(resourceProvider); | 93 m_hudTexture = ScopedResource::create(resourceProvider); |
111 | 94 |
112 // TODO(danakj): Scale the HUD by deviceScale to make it more friendly under
high DPI. | 95 // TODO(danakj): Scale the HUD by deviceScale to make it more friendly under
high DPI. |
113 | 96 |
114 // TODO(danakj): The HUD could swap between two textures instead of creating
a texture every frame in ubercompositor. | 97 // TODO(danakj): The HUD could swap between two textures instead of creating
a texture every frame in ubercompositor. |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 529 |
547 canvas->restore(); | 530 canvas->restore(); |
548 } | 531 } |
549 | 532 |
550 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const | 533 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const |
551 { | 534 { |
552 return "HeadsUpDisplayLayer"; | 535 return "HeadsUpDisplayLayer"; |
553 } | 536 } |
554 | 537 |
555 } // namespace cc | 538 } // namespace cc |
OLD | NEW |