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(); | |
282 DCHECK(hasFontAtlas()); | |
283 m_hudLayer->setShowFPSCounter(show); | |
284 setNeedsCommit(); | |
enne (OOO)
2012/10/24 18:35:27
You have multiple layers of setNeedsCommit here.
| |
285 } | |
286 | |
287 bool CCLayerTreeHost::hasFontAtlas() const | |
288 { | |
289 return m_hudLayer && m_hudLayer->hasFontAtlas(); | |
290 } | |
291 | |
280 void CCLayerTreeHost::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas) | 292 void CCLayerTreeHost::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas) |
281 { | 293 { |
282 m_fontAtlas = fontAtlas.Pass(); | 294 createHUDLayerIfNeeded(); |
enne (OOO)
2012/10/24 18:35:27
Why does this create the hud layer? What if none o
| |
295 m_hudLayer->setFontAtlas(fontAtlas.Pass()); | |
283 setNeedsCommit(); | 296 setNeedsCommit(); |
284 } | 297 } |
285 | 298 |
299 void CCLayerTreeHost::createHUDLayerIfNeeded() | |
300 { | |
301 if (!m_hudLayer) | |
302 m_hudLayer = HeadsUpDisplayLayerChromium::create(); | |
303 } | |
304 | |
286 void CCLayerTreeHost::willCommit() | 305 void CCLayerTreeHost::willCommit() |
287 { | 306 { |
288 m_client->willCommit(); | 307 m_client->willCommit(); |
289 if (m_rootLayer && m_settings.showDebugInfo()) { | |
290 if (!m_hudLayer) | |
291 m_hudLayer = HeadsUpDisplayLayerChromium::create(); | |
292 | 308 |
293 if (m_fontAtlas.get()) | 309 if (m_settings.showDebugRects()) |
294 m_hudLayer->setFontAtlas(m_fontAtlas.Pass()); | 310 createHUDLayerIfNeeded(); |
295 | 311 |
296 if (!m_hudLayer->parent()) | 312 if (m_settings.showPlatformLayerTree) |
297 m_rootLayer->addChild(m_hudLayer); | 313 DCHECK(hasFontAtlas()); |
enne (OOO)
2012/10/24 18:35:27
Maybe just move all the checks for the font atlas
| |
298 } | 314 |
315 if (m_rootLayer && m_hudLayer && !m_hudLayer->parent()) | |
316 m_rootLayer->addChild(m_hudLayer); | |
299 } | 317 } |
300 | 318 |
301 void CCLayerTreeHost::commitComplete() | 319 void CCLayerTreeHost::commitComplete() |
302 { | 320 { |
303 m_deleteTextureAfterCommitList.clear(); | 321 m_deleteTextureAfterCommitList.clear(); |
304 m_client->didCommit(); | 322 m_client->didCommit(); |
305 } | 323 } |
306 | 324 |
307 scoped_ptr<CCGraphicsContext> CCLayerTreeHost::createContext() | 325 scoped_ptr<CCGraphicsContext> CCLayerTreeHost::createContext() |
308 { | 326 { |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 else | 835 else |
818 layer->notifyAnimationFinished(wallClockTime); | 836 layer->notifyAnimationFinished(wallClockTime); |
819 } | 837 } |
820 } | 838 } |
821 | 839 |
822 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) | 840 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) |
823 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); | 841 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); |
824 } | 842 } |
825 | 843 |
826 } // namespace cc | 844 } // namespace cc |
OLD | NEW |