Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: cc/layer_tree_host.cc

Issue 11189037: toggle FPS counter in compositor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to 166046 Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layer_tree_host.h ('k') | webkit/compositor_bindings/web_layer_tree_view_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "Region.h" 9 #include "Region.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 21 matching lines...) Expand all
32 namespace { 32 namespace {
33 static int numLayerTreeInstances; 33 static int numLayerTreeInstances;
34 } 34 }
35 35
36 namespace cc { 36 namespace cc {
37 37
38 bool LayerTreeHost::s_needsFilterContext = false; 38 bool LayerTreeHost::s_needsFilterContext = false;
39 39
40 LayerTreeSettings::LayerTreeSettings() 40 LayerTreeSettings::LayerTreeSettings()
41 : acceleratePainting(false) 41 : acceleratePainting(false)
42 , showFPSCounter(false)
43 , showPlatformLayerTree(false) 42 , showPlatformLayerTree(false)
44 , showPaintRects(false) 43 , showPaintRects(false)
45 , showPropertyChangedRects(false) 44 , showPropertyChangedRects(false)
46 , showSurfaceDamageRects(false) 45 , showSurfaceDamageRects(false)
47 , showScreenSpaceRects(false) 46 , showScreenSpaceRects(false)
48 , showReplicaScreenSpaceRects(false) 47 , showReplicaScreenSpaceRects(false)
49 , showOccludingRects(false) 48 , showOccludingRects(false)
50 , renderVSyncEnabled(true) 49 , renderVSyncEnabled(true)
51 , refreshRate(0) 50 , refreshRate(0)
52 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) 51 , maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 hostImpl->setSourceFrameNumber(commitNumber()); 272 hostImpl->setSourceFrameNumber(commitNumber());
274 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); 273 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize());
275 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); 274 hostImpl->setDeviceScaleFactor(deviceScaleFactor());
276 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor); 275 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor);
277 hostImpl->setBackgroundColor(m_backgroundColor); 276 hostImpl->setBackgroundColor(m_backgroundColor);
278 hostImpl->setHasTransparentBackground(m_hasTransparentBackground); 277 hostImpl->setHasTransparentBackground(m_hasTransparentBackground);
279 278
280 m_commitNumber++; 279 m_commitNumber++;
281 } 280 }
282 281
282 void LayerTreeHost::createHUDLayerIfNeeded()
283 {
284 if (!m_hudLayer)
285 m_hudLayer = HeadsUpDisplayLayer::create();
286 }
287
288 void LayerTreeHost::setShowFPSCounter(bool show)
289 {
290 createHUDLayerIfNeeded();
291 m_hudLayer->setShowFPSCounter(show);
292 }
293
283 void LayerTreeHost::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) 294 void LayerTreeHost::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas)
284 { 295 {
285 m_fontAtlas = fontAtlas.Pass(); 296 createHUDLayerIfNeeded();
286 setNeedsCommit(); 297 m_hudLayer->setFontAtlas(fontAtlas.Pass());
287 } 298 }
288 299
289 void LayerTreeHost::willCommit() 300 void LayerTreeHost::willCommit()
290 { 301 {
291 m_client->willCommit(); 302 m_client->willCommit();
292 if (m_rootLayer && m_settings.showDebugInfo()) {
293 if (!m_hudLayer)
294 m_hudLayer = HeadsUpDisplayLayer::create();
295 303
296 if (m_fontAtlas.get()) 304 if (m_settings.showDebugInfo())
297 m_hudLayer->setFontAtlas(m_fontAtlas.Pass()); 305 createHUDLayerIfNeeded();
298 306
299 if (!m_hudLayer->parent()) 307 if (m_rootLayer && m_hudLayer && !m_hudLayer->parent())
300 m_rootLayer->addChild(m_hudLayer); 308 m_rootLayer->addChild(m_hudLayer);
301 }
302 } 309 }
303 310
304 void LayerTreeHost::commitComplete() 311 void LayerTreeHost::commitComplete()
305 { 312 {
306 m_client->didCommit(); 313 m_client->didCommit();
307 } 314 }
308 315
309 scoped_ptr<GraphicsContext> LayerTreeHost::createContext() 316 scoped_ptr<GraphicsContext> LayerTreeHost::createContext()
310 { 317 {
311 return m_client->createOutputSurface(); 318 return m_client->createOutputSurface();
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 else 840 else
834 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); 841 layer->notifyAnimationFinished(wallClockTime.ToDoubleT());
835 } 842 }
836 } 843 }
837 844
838 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 845 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
839 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 846 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
840 } 847 }
841 848
842 } // namespace cc 849 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host.h ('k') | webkit/compositor_bindings/web_layer_tree_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698