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

Side by Side Diff: cc/heads_up_display_layer_impl.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_impl.h ('k') | cc/layer_tree_host.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_impl.h" 7 #include "cc/heads_up_display_layer_impl.h"
8 8
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "cc/debug_rect_history.h" 10 #include "cc/debug_rect_history.h"
(...skipping 28 matching lines...) Expand all
39 39
40 SkPaint paint; 40 SkPaint paint;
41 paint.setColorFilter(new SkColorMatrixFilter(swizzleMatrix))->unref(); 41 paint.setColorFilter(new SkColorMatrixFilter(swizzleMatrix))->unref();
42 return paint; 42 return paint;
43 } 43 }
44 44
45 HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(int id) 45 HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(int id)
46 : LayerImpl(id) 46 : LayerImpl(id)
47 , m_averageFPS(0) 47 , m_averageFPS(0)
48 , m_stdDeviation(0) 48 , m_stdDeviation(0)
49 , m_showFPSCounter(false)
49 { 50 {
50 } 51 }
51 52
52 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() 53 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl()
53 { 54 {
54 } 55 }
55 56
56 void HeadsUpDisplayLayerImpl::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas) 57 void HeadsUpDisplayLayerImpl::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas)
57 { 58 {
58 m_fontAtlas = fontAtlas.Pass(); 59 m_fontAtlas = fontAtlas.Pass();
59 } 60 }
60 61
62 void HeadsUpDisplayLayerImpl::setShowFPSCounter(bool show)
63 {
64 m_showFPSCounter = show;
65 }
66
61 void HeadsUpDisplayLayerImpl::willDraw(ResourceProvider* resourceProvider) 67 void HeadsUpDisplayLayerImpl::willDraw(ResourceProvider* resourceProvider)
62 { 68 {
63 LayerImpl::willDraw(resourceProvider); 69 LayerImpl::willDraw(resourceProvider);
64 70
65 if (!m_hudTexture) 71 if (!m_hudTexture)
66 m_hudTexture = ScopedTexture::create(resourceProvider); 72 m_hudTexture = ScopedTexture::create(resourceProvider);
67 73
68 // FIXME: Scale the HUD by deviceScale to make it more friendly under high D PI. 74 // FIXME: Scale the HUD by deviceScale to make it more friendly under high D PI.
69 75
70 if (m_hudTexture->size() != bounds()) 76 if (m_hudTexture->size() != bounds())
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 const LayerTreeSettings& settings = layerTreeHostImpl()->settings(); 147 const LayerTreeSettings& settings = layerTreeHostImpl()->settings();
142 148
143 if (settings.showPlatformLayerTree) { 149 if (settings.showPlatformLayerTree) {
144 SkPaint paint = createPaint(); 150 SkPaint paint = createPaint();
145 paint.setColor(SkColorSetARGB(192, 0, 0, 0)); 151 paint.setColor(SkColorSetARGB(192, 0, 0, 0));
146 canvas->drawRect(SkRect::MakeXYWH(0, 0, bounds().width(), bounds().heigh t()), paint); 152 canvas->drawRect(SkRect::MakeXYWH(0, 0, bounds().width(), bounds().heigh t()), paint);
147 } 153 }
148 154
149 int platformLayerTreeTop = 0; 155 int platformLayerTreeTop = 0;
150 156
151 if (settings.showFPSCounter) 157 if (m_showFPSCounter)
152 platformLayerTreeTop = drawFPSCounter(canvas, layerTreeHostImpl()->fpsCo unter()); 158 platformLayerTreeTop = drawFPSCounter(canvas, layerTreeHostImpl()->fpsCo unter());
153 159
154 if (settings.showPlatformLayerTree && m_fontAtlas.get()) { 160 if (settings.showPlatformLayerTree && m_fontAtlas.get()) {
155 std::string layerTree = layerTreeHostImpl()->layerTreeAsText(); 161 std::string layerTree = layerTreeHostImpl()->layerTreeAsText();
156 m_fontAtlas->drawText(canvas, createPaint(), layerTree, gfx::Point(2, pl atformLayerTreeTop), bounds()); 162 m_fontAtlas->drawText(canvas, createPaint(), layerTree, gfx::Point(2, pl atformLayerTreeTop), bounds());
157 } 163 }
158 164
159 if (settings.showDebugRects()) 165 if (settings.showDebugRects())
160 drawDebugRects(canvas, layerTreeHostImpl()->debugRectHistory()); 166 drawDebugRects(canvas, layerTreeHostImpl()->debugRectHistory());
161 } 167 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 canvas->drawRect(skRect, paint); 321 canvas->drawRect(skRect, paint);
316 } 322 }
317 } 323 }
318 324
319 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const 325 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const
320 { 326 {
321 return "HeadsUpDisplayLayer"; 327 return "HeadsUpDisplayLayer";
322 } 328 }
323 329
324 } // namespace cc 330 } // namespace cc
OLDNEW
« no previous file with comments | « cc/heads_up_display_layer_impl.h ('k') | cc/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698