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

Side by Side Diff: cc/heads_up_display_layer_impl.cc

Issue 11360010: cc: Pass gfx::Size type to FontAtlas drawText() function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | Annotate | Revision Log
« no previous file with comments | « cc/font_atlas.cc ('k') | no next file » | 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 if (settings.showFPSCounter) 150 if (settings.showFPSCounter)
151 platformLayerTreeTop = fpsCounterTop + fpsCounterHeight; 151 platformLayerTreeTop = fpsCounterTop + fpsCounterHeight;
152 else 152 else
153 platformLayerTreeTop = 0; 153 platformLayerTreeTop = 0;
154 154
155 if (settings.showFPSCounter) 155 if (settings.showFPSCounter)
156 drawFPSCounter(canvas, layerTreeHostImpl()->fpsCounter(), fpsCounterTop, fpsCounterHeight); 156 drawFPSCounter(canvas, layerTreeHostImpl()->fpsCounter(), fpsCounterTop, fpsCounterHeight);
157 157
158 if (settings.showPlatformLayerTree && m_fontAtlas.get()) { 158 if (settings.showPlatformLayerTree && m_fontAtlas.get()) {
159 std::string layerTree = layerTreeHostImpl()->layerTreeAsText(); 159 std::string layerTree = layerTreeHostImpl()->layerTreeAsText();
160 m_fontAtlas->drawText(canvas, createPaint(), layerTree, gfx::Point(2, pl atformLayerTreeTop), bounds()); 160 gfx::Size clip_bounds(bounds().width(), bounds().height());
161 m_fontAtlas->drawText(canvas, createPaint(), layerTree, gfx::Point(2, pl atformLayerTreeTop), clip_bounds);
danakj 2012/10/31 16:29:30 Shouldn't need this bit. Just pass bounds() direct
tfarina 2012/10/31 16:32:23 Ah, nice! Didn't know that. Done.
161 } 162 }
162 163
163 if (settings.showDebugRects()) 164 if (settings.showDebugRects())
164 drawDebugRects(canvas, layerTreeHostImpl()->debugRectHistory()); 165 drawDebugRects(canvas, layerTreeHostImpl()->debugRectHistory());
165 } 166 }
166 167
167 void HeadsUpDisplayLayerImpl::drawFPSCounter(SkCanvas* canvas, FrameRateCounter* fpsCounter, int top, int height) 168 void HeadsUpDisplayLayerImpl::drawFPSCounter(SkCanvas* canvas, FrameRateCounter* fpsCounter, int top, int height)
168 { 169 {
169 float textWidth = 170; // so text fits on linux. 170 float textWidth = 170; // so text fits on linux.
170 float graphWidth = fpsCounter->timeStampHistorySize(); 171 float graphWidth = fpsCounter->timeStampHistorySize();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 double averageFPS, stdDeviation; 226 double averageFPS, stdDeviation;
226 fpsCounter->getAverageFPSAndStandardDeviation(averageFPS, stdDeviation); 227 fpsCounter->getAverageFPSAndStandardDeviation(averageFPS, stdDeviation);
227 228
228 // Draw background. 229 // Draw background.
229 SkPaint paint = createPaint(); 230 SkPaint paint = createPaint();
230 paint.setColor(SK_ColorBLACK); 231 paint.setColor(SK_ColorBLACK);
231 canvas->drawRect(SkRect::MakeXYWH(2, top, width, height), paint); 232 canvas->drawRect(SkRect::MakeXYWH(2, top, width, height), paint);
232 233
233 // Draw FPS text. 234 // Draw FPS text.
234 if (m_fontAtlas.get()) 235 if (m_fontAtlas.get())
235 m_fontAtlas->drawText(canvas, createPaint(), base::StringPrintf("FPS: %4 .1f +/- %3.1f", averageFPS, stdDeviation), gfx::Point(10, height / 3), IntSize(w idth, height)); 236 m_fontAtlas->drawText(canvas, createPaint(), base::StringPrintf("FPS: %4 .1f +/- %3.1f", averageFPS, stdDeviation), gfx::Point(10, height / 3), gfx::Size (width, height));
236 } 237 }
237 238
238 void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory* debugRectHistory) 239 void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory* debugRectHistory)
239 { 240 {
240 const std::vector<DebugRect>& debugRects = debugRectHistory->debugRects(); 241 const std::vector<DebugRect>& debugRects = debugRectHistory->debugRects();
241 242
242 for (size_t i = 0; i < debugRects.size(); ++i) { 243 for (size_t i = 0; i < debugRects.size(); ++i) {
243 SkColor strokeColor = 0; 244 SkColor strokeColor = 0;
244 SkColor fillColor = 0; 245 SkColor fillColor = 0;
245 246
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 canvas->drawRect(skRect, paint); 289 canvas->drawRect(skRect, paint);
289 } 290 }
290 } 291 }
291 292
292 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const 293 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const
293 { 294 {
294 return "HeadsUpDisplayLayer"; 295 return "HeadsUpDisplayLayer";
295 } 296 }
296 297
297 } // namespace cc 298 } // namespace cc
OLDNEW
« no previous file with comments | « cc/font_atlas.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698