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

Side by Side Diff: cc/heads_up_display_layer.cc

Issue 11414017: cc: handling debug settings in new LayerTreeDebugState structure (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
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 "cc/heads_up_display_layer.h" 5 #include "cc/heads_up_display_layer.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/heads_up_display_layer_impl.h" 8 #include "cc/heads_up_display_layer_impl.h"
9 #include "cc/layer_tree_host.h" 9 #include "cc/layer_tree_host.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 HeadsUpDisplayLayerFlags::HeadsUpDisplayLayerFlags()
14 : showFPSCounter(false)
15 , showPlatformLayerTree(false)
16 , showPaintRects(false)
17 , showPropertyChangedRects(false)
18 , showSurfaceDamageRects(false)
19 , showScreenSpaceRects(false)
20 , showReplicaScreenSpaceRects(false)
21 , showOccludingRects(false)
22 , showNonOccludingRects(false)
23 {
24 }
25
26 bool HeadsUpDisplayLayerFlags::showDebugInfo() const
27 {
28 return showFPSCounter || showPlatformLayerTree || showDebugRects();
29 }
30
31 bool HeadsUpDisplayLayerFlags::showDebugRects() const
32 {
33 return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects || showNonOccludingRects;
34 }
35
13 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create() 36 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create()
14 { 37 {
15 return make_scoped_refptr(new HeadsUpDisplayLayer()); 38 return make_scoped_refptr(new HeadsUpDisplayLayer());
16 } 39 }
17 40
18 HeadsUpDisplayLayer::HeadsUpDisplayLayer() 41 HeadsUpDisplayLayer::HeadsUpDisplayLayer()
19 : Layer() 42 : Layer()
20 , m_showFPSCounter(false)
21 { 43 {
22 setBounds(gfx::Size(256, 128)); 44 setBounds(gfx::Size(256, 128));
23 } 45 }
24 46
25 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() 47 HeadsUpDisplayLayer::~HeadsUpDisplayLayer()
26 { 48 {
27 } 49 }
28 50
29 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&) 51 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&)
30 { 52 {
31 const LayerTreeSettings& settings = layerTreeHost()->settings();
32 int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize; 53 int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize;
33 54
34 gfx::Size bounds; 55 gfx::Size bounds;
35 WebKit::WebTransformationMatrix matrix; 56 WebKit::WebTransformationMatrix matrix;
36 matrix.makeIdentity(); 57 matrix.makeIdentity();
37 58
38 if (settings.showPlatformLayerTree || settings.showDebugRects()) { 59 if (m_flags.showPlatformLayerTree || m_flags.showDebugRects()) {
39 int width = std::min(maxTextureSize, layerTreeHost()->deviceViewportSize ().width()); 60 int width = std::min(maxTextureSize, layerTreeHost()->deviceViewportSize ().width());
40 int height = std::min(maxTextureSize, layerTreeHost()->deviceViewportSiz e().height()); 61 int height = std::min(maxTextureSize, layerTreeHost()->deviceViewportSiz e().height());
41 bounds = gfx::Size(width, height); 62 bounds = gfx::Size(width, height);
42 } else { 63 } else {
43 bounds = gfx::Size(256, 128); 64 bounds = gfx::Size(256, 128);
44 matrix.translate(layerTreeHost()->deviceViewportSize().width() - 256, 0) ; 65 matrix.translate(layerTreeHost()->deviceViewportSize().width() - 256, 0) ;
45 } 66 }
46 67
47 setBounds(bounds); 68 setBounds(bounds);
48 setTransform(matrix); 69 setTransform(matrix);
49 } 70 }
50 71
51 bool HeadsUpDisplayLayer::drawsContent() const 72 bool HeadsUpDisplayLayer::drawsContent() const
52 { 73 {
53 return true; 74 return true;
54 } 75 }
55 76
77 void HeadsUpDisplayLayer::setFlags(HeadsUpDisplayLayerFlags& flags)
78 {
79 m_flags = flags;
80 }
81
56 void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) 82 void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas)
57 { 83 {
58 m_fontAtlas = fontAtlas.Pass(); 84 m_fontAtlas = fontAtlas.Pass();
59 setNeedsCommit(); 85 setNeedsCommit();
60 } 86 }
61 87
62 void HeadsUpDisplayLayer::setShowFPSCounter(bool show) 88 void HeadsUpDisplayLayer::setShowFPSCounter(bool show)
63 { 89 {
64 m_showFPSCounter = show; 90 m_flags.showFPSCounter = show;
65 setNeedsCommit(); 91 setNeedsCommit();
66 } 92 }
67 93
94 void HeadsUpDisplayLayer::setShowPaintRects(bool show)
95 {
96 m_flags.showPaintRects = show;
97 setNeedsCommit();
98 }
99
100 void HeadsUpDisplayLayer::setShowPlatformLayerTree(bool show)
101 {
102 m_flags.showPlatformLayerTree = show;
103 setNeedsCommit();
104 }
105
68 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl() 106 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl()
69 { 107 {
70 return HeadsUpDisplayLayerImpl::create(m_layerId).PassAs<LayerImpl>(); 108 return HeadsUpDisplayLayerImpl::create(m_layerId).PassAs<LayerImpl>();
71 } 109 }
72 110
73 void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl) 111 void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl)
74 { 112 {
75 Layer::pushPropertiesTo(layerImpl); 113 Layer::pushPropertiesTo(layerImpl);
76 114
77 HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl* >(layerImpl); 115 HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl* >(layerImpl);
78 hudLayerImpl->setShowFPSCounter(m_showFPSCounter); 116 hudLayerImpl->setFlags(m_flags);
79 117
80 if (m_fontAtlas.get()) 118 if (m_fontAtlas.get())
81 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass()); 119 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass());
82 } 120 }
83 121
84 } // namespace cc 122 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698