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

Side by Side Diff: cc/heads_up_display_layer.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/heads_up_display_layer.h ('k') | cc/heads_up_display_layer_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/heads_up_display_layer.h" 7 #include "cc/heads_up_display_layer.h"
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "cc/heads_up_display_layer_impl.h" 10 #include "cc/heads_up_display_layer_impl.h"
11 #include "cc/layer_tree_host.h" 11 #include "cc/layer_tree_host.h"
12 12
13 namespace cc { 13 namespace cc {
14 14
15 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create() 15 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create()
16 { 16 {
17 return make_scoped_refptr(new HeadsUpDisplayLayer()); 17 return make_scoped_refptr(new HeadsUpDisplayLayer());
18 } 18 }
19 19
20 HeadsUpDisplayLayer::HeadsUpDisplayLayer() 20 HeadsUpDisplayLayer::HeadsUpDisplayLayer()
21 : Layer() 21 : Layer()
22 , m_showFPSCounter(false)
22 { 23 {
23
24 setBounds(gfx::Size(256, 128)); 24 setBounds(gfx::Size(256, 128));
25 } 25 }
26 26
27 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() 27 HeadsUpDisplayLayer::~HeadsUpDisplayLayer()
28 { 28 {
29 } 29 }
30 30
31 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&) 31 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&)
32 { 32 {
33 const LayerTreeSettings& settings = layerTreeHost()->settings(); 33 const LayerTreeSettings& settings = layerTreeHost()->settings();
(...skipping 15 matching lines...) Expand all
49 { 49 {
50 return true; 50 return true;
51 } 51 }
52 52
53 void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) 53 void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas)
54 { 54 {
55 m_fontAtlas = fontAtlas.Pass(); 55 m_fontAtlas = fontAtlas.Pass();
56 setNeedsCommit(); 56 setNeedsCommit();
57 } 57 }
58 58
59 void HeadsUpDisplayLayer::setShowFPSCounter(bool show)
60 {
61 m_showFPSCounter = show;
62 setNeedsCommit();
63 }
64
59 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl() 65 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl()
60 { 66 {
61 return HeadsUpDisplayLayerImpl::create(m_layerId).PassAs<LayerImpl>(); 67 return HeadsUpDisplayLayerImpl::create(m_layerId).PassAs<LayerImpl>();
62 } 68 }
63 69
64 void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl) 70 void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl)
65 { 71 {
66 Layer::pushPropertiesTo(layerImpl); 72 Layer::pushPropertiesTo(layerImpl);
67 73
68 if (!m_fontAtlas.get()) 74 HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl* >(layerImpl);
69 return; 75 hudLayerImpl->setShowFPSCounter(m_showFPSCounter);
70 76
71 HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl* >(layerImpl); 77 if (m_fontAtlas.get())
72 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass()); 78 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass());
73 } 79 }
74 80
75 } // namespace cc 81 } // namespace cc
OLDNEW
« no previous file with comments | « cc/heads_up_display_layer.h ('k') | cc/heads_up_display_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698