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 "CCLayerTreeHost.h" | 7 #include "CCLayerTreeHost.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 CCLayerTreeHost::s_needsFilterContext = false; | 37 bool CCLayerTreeHost::s_needsFilterContext = false; |
38 | 38 |
39 CCLayerTreeSettings::CCLayerTreeSettings() | 39 CCLayerTreeSettings::CCLayerTreeSettings() |
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 CCLayerTreeHost::setShowFPSCounter(bool show) | |
280 { | |
281 createHUDLayerIfNeeded(); | |
danakj
2012/10/23 15:19:53
Can we DCHECK some stuff here?
DCHECK(m_hudLayer);
| |
282 m_hudLayer->setShowFPSCounter(show); | |
283 setNeedsCommit(); | |
284 } | |
285 | |
280 void CCLayerTreeHost::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas) | 286 void CCLayerTreeHost::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas) |
281 { | 287 { |
282 m_fontAtlas = fontAtlas.Pass(); | 288 createHUDLayerIfNeeded(); |
289 m_hudLayer->setFontAtlas(fontAtlas.Pass()); | |
283 setNeedsCommit(); | 290 setNeedsCommit(); |
284 } | 291 } |
285 | 292 |
293 void CCLayerTreeHost::createHUDLayerIfNeeded() | |
294 { | |
295 if (!m_hudLayer) | |
296 m_hudLayer = HeadsUpDisplayLayerChromium::create(); | |
297 } | |
298 | |
286 void CCLayerTreeHost::willCommit() | 299 void CCLayerTreeHost::willCommit() |
287 { | 300 { |
288 m_client->willCommit(); | 301 m_client->willCommit(); |
289 if (m_rootLayer && m_settings.showDebugInfo()) { | |
290 if (!m_hudLayer) | |
291 m_hudLayer = HeadsUpDisplayLayerChromium::create(); | |
292 | 302 |
293 if (m_fontAtlas.get()) | 303 if (m_settings.showDebugRects()) |
danakj
2012/10/23 15:19:53
This is missing m_settings.showPlatformLayerTree.
| |
294 m_hudLayer->setFontAtlas(m_fontAtlas.Pass()); | 304 createHUDLayerIfNeeded(); |
295 | 305 |
296 if (!m_hudLayer->parent()) | 306 if (m_rootLayer && m_hudLayer && !m_hudLayer->parent()) |
297 m_rootLayer->addChild(m_hudLayer); | 307 m_rootLayer->addChild(m_hudLayer); |
298 } | |
299 } | 308 } |
300 | 309 |
301 void CCLayerTreeHost::commitComplete() | 310 void CCLayerTreeHost::commitComplete() |
302 { | 311 { |
303 m_deleteTextureAfterCommitList.clear(); | 312 m_deleteTextureAfterCommitList.clear(); |
304 m_client->didCommit(); | 313 m_client->didCommit(); |
305 } | 314 } |
306 | 315 |
307 scoped_ptr<CCGraphicsContext> CCLayerTreeHost::createContext() | 316 scoped_ptr<CCGraphicsContext> CCLayerTreeHost::createContext() |
308 { | 317 { |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 else | 826 else |
818 layer->notifyAnimationFinished(wallClockTime); | 827 layer->notifyAnimationFinished(wallClockTime); |
819 } | 828 } |
820 } | 829 } |
821 | 830 |
822 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) | 831 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) |
823 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); | 832 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); |
824 } | 833 } |
825 | 834 |
826 } // namespace cc | 835 } // namespace cc |
OLD | NEW |