| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 , m_settings(settings) | 103 , m_settings(settings) |
| 104 , m_deviceScaleFactor(1) | 104 , m_deviceScaleFactor(1) |
| 105 , m_visible(true) | 105 , m_visible(true) |
| 106 , m_pageScaleFactor(1) | 106 , m_pageScaleFactor(1) |
| 107 , m_minPageScaleFactor(1) | 107 , m_minPageScaleFactor(1) |
| 108 , m_maxPageScaleFactor(1) | 108 , m_maxPageScaleFactor(1) |
| 109 , m_triggerIdleUpdates(true) | 109 , m_triggerIdleUpdates(true) |
| 110 , m_backgroundColor(SK_ColorWHITE) | 110 , m_backgroundColor(SK_ColorWHITE) |
| 111 , m_hasTransparentBackground(false) | 111 , m_hasTransparentBackground(false) |
| 112 , m_partialTextureUpdateRequests(0) | 112 , m_partialTextureUpdateRequests(0) |
| 113 , m_showFPSCounter(false) |
| 113 { | 114 { |
| 114 ASSERT(CCProxy::isMainThread()); | 115 ASSERT(CCProxy::isMainThread()); |
| 115 numLayerTreeInstances++; | 116 numLayerTreeInstances++; |
| 116 } | 117 } |
| 117 | 118 |
| 118 bool CCLayerTreeHost::initialize() | 119 bool CCLayerTreeHost::initialize() |
| 119 { | 120 { |
| 120 TRACE_EVENT0("cc", "CCLayerTreeHost::initialize"); | 121 TRACE_EVENT0("cc", "CCLayerTreeHost::initialize"); |
| 121 | 122 |
| 122 if (CCProxy::hasImplThread()) | 123 if (CCProxy::hasImplThread()) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 hostImpl->setSourceFrameNumber(commitNumber()); | 271 hostImpl->setSourceFrameNumber(commitNumber()); |
| 271 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); | 272 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); |
| 272 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); | 273 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); |
| 273 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto
r, m_maxPageScaleFactor); | 274 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto
r, m_maxPageScaleFactor); |
| 274 hostImpl->setBackgroundColor(m_backgroundColor); | 275 hostImpl->setBackgroundColor(m_backgroundColor); |
| 275 hostImpl->setHasTransparentBackground(m_hasTransparentBackground); | 276 hostImpl->setHasTransparentBackground(m_hasTransparentBackground); |
| 276 | 277 |
| 277 m_commitNumber++; | 278 m_commitNumber++; |
| 278 } | 279 } |
| 279 | 280 |
| 281 void CCLayerTreeHost::setShowFPSCounter(bool show) |
| 282 { |
| 283 m_showFPSCounter = show; |
| 284 m_proxy->setShowFPSCounter(show); |
| 285 } |
| 286 |
| 280 void CCLayerTreeHost::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas) | 287 void CCLayerTreeHost::setFontAtlas(scoped_ptr<CCFontAtlas> fontAtlas) |
| 281 { | 288 { |
| 282 m_fontAtlas = fontAtlas.Pass(); | 289 m_fontAtlas = fontAtlas.Pass(); |
| 283 setNeedsCommit(); | 290 setNeedsCommit(); |
| 284 } | 291 } |
| 285 | 292 |
| 286 void CCLayerTreeHost::willCommit() | 293 void CCLayerTreeHost::willCommit() |
| 287 { | 294 { |
| 288 m_client->willCommit(); | 295 m_client->willCommit(); |
| 289 if (m_rootLayer && m_settings.showDebugInfo()) { | 296 if (m_rootLayer && (m_settings.showDebugInfo() || m_showFPSCounter)) { |
| 290 if (!m_hudLayer) | 297 if (!m_hudLayer) |
| 291 m_hudLayer = HeadsUpDisplayLayerChromium::create(); | 298 m_hudLayer = HeadsUpDisplayLayerChromium::create(); |
| 292 | 299 |
| 293 if (m_fontAtlas.get()) | 300 if (m_fontAtlas.get()) |
| 294 m_hudLayer->setFontAtlas(m_fontAtlas.Pass()); | 301 m_hudLayer->setFontAtlas(m_fontAtlas.Pass()); |
| 295 | 302 |
| 296 if (!m_hudLayer->parent()) | 303 if (!m_hudLayer->parent()) |
| 297 m_rootLayer->addChild(m_hudLayer); | 304 m_rootLayer->addChild(m_hudLayer); |
| 298 } | 305 } |
| 299 } | 306 } |
| (...skipping 517 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 |