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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 , m_settings(settings) | 102 , m_settings(settings) |
104 , m_deviceScaleFactor(1) | 103 , m_deviceScaleFactor(1) |
105 , m_visible(true) | 104 , m_visible(true) |
106 , m_pageScaleFactor(1) | 105 , m_pageScaleFactor(1) |
107 , m_minPageScaleFactor(1) | 106 , m_minPageScaleFactor(1) |
108 , m_maxPageScaleFactor(1) | 107 , m_maxPageScaleFactor(1) |
109 , m_triggerIdleUpdates(true) | 108 , m_triggerIdleUpdates(true) |
110 , m_backgroundColor(SK_ColorWHITE) | 109 , m_backgroundColor(SK_ColorWHITE) |
111 , m_hasTransparentBackground(false) | 110 , m_hasTransparentBackground(false) |
112 , m_partialTextureUpdateRequests(0) | 111 , m_partialTextureUpdateRequests(0) |
112 , m_showFPSCounter(false) | |
113 { | 113 { |
114 ASSERT(CCProxy::isMainThread()); | 114 ASSERT(CCProxy::isMainThread()); |
115 numLayerTreeInstances++; | 115 numLayerTreeInstances++; |
116 } | 116 } |
117 | 117 |
118 bool CCLayerTreeHost::initialize() | 118 bool CCLayerTreeHost::initialize() |
119 { | 119 { |
120 TRACE_EVENT0("cc", "CCLayerTreeHost::initialize"); | 120 TRACE_EVENT0("cc", "CCLayerTreeHost::initialize"); |
121 | 121 |
122 if (CCProxy::hasImplThread()) | 122 if (CCProxy::hasImplThread()) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
270 hostImpl->setSourceFrameNumber(commitNumber()); | 270 hostImpl->setSourceFrameNumber(commitNumber()); |
271 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); | 271 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); |
272 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); | 272 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); |
273 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor); | 273 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor); |
274 hostImpl->setBackgroundColor(m_backgroundColor); | 274 hostImpl->setBackgroundColor(m_backgroundColor); |
275 hostImpl->setHasTransparentBackground(m_hasTransparentBackground); | 275 hostImpl->setHasTransparentBackground(m_hasTransparentBackground); |
276 | 276 |
277 m_commitNumber++; | 277 m_commitNumber++; |
278 } | 278 } |
279 | 279 |
280 void CCLayerTreeHost::setShowFPSCounter(bool show) | |
281 { | |
282 m_showFPSCounter = show; | |
283 m_proxy->setShowFPSCounter(show); | |
nduca
2012/10/20 19:49:41
so what happens if you set the atlas, then call se
| |
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 m_fontAtlas = fontAtlas.Pass(); |
283 setNeedsCommit(); | 289 setNeedsCommit(); |
284 } | 290 } |
285 | 291 |
286 void CCLayerTreeHost::willCommit() | 292 void CCLayerTreeHost::willCommit() |
287 { | 293 { |
288 m_client->willCommit(); | 294 m_client->willCommit(); |
289 if (m_rootLayer && m_settings.showDebugInfo()) { | 295 if (m_rootLayer && (m_settings.showDebugInfo() || m_showFPSCounter)) { |
290 if (!m_hudLayer) | 296 if (!m_hudLayer) |
291 m_hudLayer = HeadsUpDisplayLayerChromium::create(); | 297 m_hudLayer = HeadsUpDisplayLayerChromium::create(); |
292 | 298 |
293 if (m_fontAtlas.get()) | 299 if (m_fontAtlas.get()) |
294 m_hudLayer->setFontAtlas(m_fontAtlas.Pass()); | 300 m_hudLayer->setFontAtlas(m_fontAtlas.Pass()); |
295 | 301 |
296 if (!m_hudLayer->parent()) | 302 if (!m_hudLayer->parent()) |
297 m_rootLayer->addChild(m_hudLayer); | 303 m_rootLayer->addChild(m_hudLayer); |
298 } | 304 } |
299 } | 305 } |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
817 else | 823 else |
818 layer->notifyAnimationFinished(wallClockTime); | 824 layer->notifyAnimationFinished(wallClockTime); |
819 } | 825 } |
820 } | 826 } |
821 | 827 |
822 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) | 828 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) |
823 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); | 829 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); |
824 } | 830 } |
825 | 831 |
826 } // namespace cc | 832 } // namespace cc |
OLD | NEW |