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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/layer_tree_host.h" | 7 #include "cc/layer_tree_host.h" |
8 | 8 |
9 #include "CCFontAtlas.h" | 9 #include "CCFontAtlas.h" |
10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 namespace { | 31 namespace { |
32 static int numLayerTreeInstances; | 32 static int numLayerTreeInstances; |
33 } | 33 } |
34 | 34 |
35 namespace cc { | 35 namespace cc { |
36 | 36 |
37 bool LayerTreeHost::s_needsFilterContext = false; | 37 bool LayerTreeHost::s_needsFilterContext = false; |
38 | 38 |
39 LayerTreeSettings::LayerTreeSettings() | 39 LayerTreeSettings::LayerTreeSettings() |
40 : acceleratePainting(false) | 40 : acceleratePainting(false) |
41 , showFPSCounter(false) | |
42 , showPlatformLayerTree(false) | 41 , showPlatformLayerTree(false) |
43 , showPaintRects(false) | 42 , showPaintRects(false) |
44 , showPropertyChangedRects(false) | 43 , showPropertyChangedRects(false) |
45 , showSurfaceDamageRects(false) | 44 , showSurfaceDamageRects(false) |
46 , showScreenSpaceRects(false) | 45 , showScreenSpaceRects(false) |
47 , showReplicaScreenSpaceRects(false) | 46 , showReplicaScreenSpaceRects(false) |
48 , showOccludingRects(false) | 47 , showOccludingRects(false) |
49 , renderVSyncEnabled(true) | 48 , renderVSyncEnabled(true) |
50 , refreshRate(0) | 49 , refreshRate(0) |
51 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) | 50 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 hostImpl->setSourceFrameNumber(commitNumber()); | 269 hostImpl->setSourceFrameNumber(commitNumber()); |
271 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); | 270 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); |
272 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); | 271 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); |
273 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor); | 272 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor); |
274 hostImpl->setBackgroundColor(m_backgroundColor); | 273 hostImpl->setBackgroundColor(m_backgroundColor); |
275 hostImpl->setHasTransparentBackground(m_hasTransparentBackground); | 274 hostImpl->setHasTransparentBackground(m_hasTransparentBackground); |
276 | 275 |
277 m_commitNumber++; | 276 m_commitNumber++; |
278 } | 277 } |
279 | 278 |
279 void LayerTreeHost::createHUDLayerIfNeeded() | |
egraether
2012/10/25 02:01:11
Called whenever there is need to create a HUDLayer
| |
280 { | |
281 if (!m_hudLayer) | |
282 m_hudLayer = HeadsUpDisplayLayer::create(); | |
283 } | |
284 | |
285 void LayerTreeHost::setShowFPSCounter(bool show) | |
286 { | |
287 createHUDLayerIfNeeded(); | |
288 m_hudLayer->setShowFPSCounter(show); | |
289 } | |
290 | |
280 void LayerTreeHost::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) | 291 void LayerTreeHost::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) |
281 { | 292 { |
282 m_fontAtlas = fontAtlas.Pass(); | 293 createHUDLayerIfNeeded(); |
283 setNeedsCommit(); | 294 m_hudLayer->setFontAtlas(fontAtlas.Pass()); |
284 } | 295 } |
285 | 296 |
286 void LayerTreeHost::willCommit() | 297 void LayerTreeHost::willCommit() |
287 { | 298 { |
288 m_client->willCommit(); | 299 m_client->willCommit(); |
289 if (m_rootLayer && m_settings.showDebugInfo()) { | |
290 if (!m_hudLayer) | |
291 m_hudLayer = HeadsUpDisplayLayer::create(); | |
292 | 300 |
293 if (m_fontAtlas.get()) | 301 if (m_settings.showDebugRects()) |
egraether
2012/10/25 02:01:11
Checking for the rects is enough here. In case sho
| |
294 m_hudLayer->setFontAtlas(m_fontAtlas.Pass()); | 302 createHUDLayerIfNeeded(); |
295 | 303 |
296 if (!m_hudLayer->parent()) | 304 if (m_rootLayer && m_hudLayer && !m_hudLayer->parent()) |
297 m_rootLayer->addChild(m_hudLayer); | 305 m_rootLayer->addChild(m_hudLayer); |
298 } | |
299 } | 306 } |
300 | 307 |
301 void LayerTreeHost::commitComplete() | 308 void LayerTreeHost::commitComplete() |
302 { | 309 { |
303 m_deleteTextureAfterCommitList.clear(); | 310 m_deleteTextureAfterCommitList.clear(); |
304 m_client->didCommit(); | 311 m_client->didCommit(); |
305 } | 312 } |
306 | 313 |
307 scoped_ptr<GraphicsContext> LayerTreeHost::createContext() | 314 scoped_ptr<GraphicsContext> LayerTreeHost::createContext() |
308 { | 315 { |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 else | 824 else |
818 layer->notifyAnimationFinished(wallClockTime); | 825 layer->notifyAnimationFinished(wallClockTime); |
819 } | 826 } |
820 } | 827 } |
821 | 828 |
822 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) | 829 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) |
823 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); | 830 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); |
824 } | 831 } |
825 | 832 |
826 } // namespace cc | 833 } // namespace cc |
OLD | NEW |