Chromium Code Reviews| 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 | 291 |
| 292 m_commitNumber++; | 292 m_commitNumber++; |
| 293 } | 293 } |
| 294 | 294 |
| 295 void LayerTreeHost::createHUDLayerIfNeeded() | 295 void LayerTreeHost::createHUDLayerIfNeeded() |
| 296 { | 296 { |
| 297 if (!m_hudLayer) | 297 if (!m_hudLayer) |
| 298 m_hudLayer = HeadsUpDisplayLayer::create(); | 298 m_hudLayer = HeadsUpDisplayLayer::create(); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void LayerTreeHost::createFontAtlasIfNeeded() | |
| 302 { | |
| 303 if (m_hudLayer && !m_hudLayer->hasFontAtlas()) | |
| 304 m_hudLayer->setFontAtlas(m_client->createFontAtlas()); | |
| 305 } | |
| 306 | |
| 301 void LayerTreeHost::setShowFPSCounter(bool show) | 307 void LayerTreeHost::setShowFPSCounter(bool show) |
| 302 { | 308 { |
| 303 createHUDLayerIfNeeded(); | 309 createHUDLayerIfNeeded(); |
| 310 createFontAtlasIfNeeded(); | |
|
jamesr
2012/11/27 21:07:44
will we ever get setShowFPSCounter(false) calls? w
egraether
2012/11/27 21:49:22
right, I'll add a check for that.
ATM there should
| |
| 304 m_hudLayer->setShowFPSCounter(show); | 311 m_hudLayer->setShowFPSCounter(show); |
| 305 } | 312 } |
| 306 | 313 |
| 307 void LayerTreeHost::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) | |
| 308 { | |
| 309 createHUDLayerIfNeeded(); | |
| 310 m_hudLayer->setFontAtlas(fontAtlas.Pass()); | |
| 311 } | |
| 312 | |
| 313 void LayerTreeHost::willCommit() | 314 void LayerTreeHost::willCommit() |
| 314 { | 315 { |
| 315 m_client->willCommit(); | 316 m_client->willCommit(); |
| 316 | 317 |
| 317 if (m_settings.showDebugInfo()) | 318 if (m_settings.showDebugInfo()) |
| 318 createHUDLayerIfNeeded(); | 319 createHUDLayerIfNeeded(); |
| 319 | 320 |
| 321 if (m_settings.showPlatformLayerTree) | |
| 322 createFontAtlasIfNeeded(); | |
| 323 | |
| 320 if (m_rootLayer && m_hudLayer && !m_hudLayer->parent()) | 324 if (m_rootLayer && m_hudLayer && !m_hudLayer->parent()) |
| 321 m_rootLayer->addChild(m_hudLayer); | 325 m_rootLayer->addChild(m_hudLayer); |
| 322 } | 326 } |
| 323 | 327 |
| 324 void LayerTreeHost::commitComplete() | 328 void LayerTreeHost::commitComplete() |
| 325 { | 329 { |
| 326 m_client->didCommit(); | 330 m_client->didCommit(); |
| 327 } | 331 } |
| 328 | 332 |
| 329 scoped_ptr<GraphicsContext> LayerTreeHost::createContext() | 333 scoped_ptr<GraphicsContext> LayerTreeHost::createContext() |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 855 else | 859 else |
| 856 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); | 860 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); |
| 857 } | 861 } |
| 858 } | 862 } |
| 859 | 863 |
| 860 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) | 864 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) |
| 861 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); | 865 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); |
| 862 } | 866 } |
| 863 | 867 |
| 864 } // namespace cc | 868 } // namespace cc |
| OLD | NEW |