OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "cc/font_atlas.h" | 10 #include "cc/font_atlas.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 292 |
293 m_commitNumber++; | 293 m_commitNumber++; |
294 } | 294 } |
295 | 295 |
296 void LayerTreeHost::createHUDLayerIfNeeded() | 296 void LayerTreeHost::createHUDLayerIfNeeded() |
297 { | 297 { |
298 if (!m_hudLayer) | 298 if (!m_hudLayer) |
299 m_hudLayer = HeadsUpDisplayLayer::create(); | 299 m_hudLayer = HeadsUpDisplayLayer::create(); |
300 } | 300 } |
301 | 301 |
| 302 void LayerTreeHost::createFontAtlasIfNeeded() |
| 303 { |
| 304 if (m_hudLayer && !m_hudLayer->hasFontAtlas()) |
| 305 m_hudLayer->setFontAtlas(m_client->createFontAtlas()); |
| 306 } |
| 307 |
302 void LayerTreeHost::setShowFPSCounter(bool show) | 308 void LayerTreeHost::setShowFPSCounter(bool show) |
303 { | 309 { |
304 createHUDLayerIfNeeded(); | 310 if (show) { |
305 m_hudLayer->setShowFPSCounter(show); | 311 createHUDLayerIfNeeded(); |
306 } | 312 createFontAtlasIfNeeded(); |
| 313 } |
307 | 314 |
308 void LayerTreeHost::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) | 315 if (m_hudLayer) |
309 { | 316 m_hudLayer->setShowFPSCounter(show); |
310 createHUDLayerIfNeeded(); | |
311 m_hudLayer->setFontAtlas(fontAtlas.Pass()); | |
312 } | 317 } |
313 | 318 |
314 void LayerTreeHost::willCommit() | 319 void LayerTreeHost::willCommit() |
315 { | 320 { |
316 m_client->willCommit(); | 321 m_client->willCommit(); |
317 | 322 |
318 if (m_settings.showDebugInfo()) | 323 if (m_settings.showDebugInfo()) |
319 createHUDLayerIfNeeded(); | 324 createHUDLayerIfNeeded(); |
320 | 325 |
| 326 if (m_settings.showPlatformLayerTree) |
| 327 createFontAtlasIfNeeded(); |
| 328 |
321 if (m_rootLayer && m_hudLayer && !m_hudLayer->parent()) | 329 if (m_rootLayer && m_hudLayer && !m_hudLayer->parent()) |
322 m_rootLayer->addChild(m_hudLayer); | 330 m_rootLayer->addChild(m_hudLayer); |
323 } | 331 } |
324 | 332 |
325 void LayerTreeHost::commitComplete() | 333 void LayerTreeHost::commitComplete() |
326 { | 334 { |
327 m_client->didCommit(); | 335 m_client->didCommit(); |
328 } | 336 } |
329 | 337 |
330 scoped_ptr<GraphicsContext> LayerTreeHost::createContext() | 338 scoped_ptr<GraphicsContext> LayerTreeHost::createContext() |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 else | 865 else |
858 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 866 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
859 } | 867 } |
860 } | 868 } |
861 | 869 |
862 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 870 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
863 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 871 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
864 } | 872 } |
865 | 873 |
866 } // namespace cc | 874 } // namespace cc |
OLD | NEW |