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

Side by Side Diff: bench/FontScalerBench.cpp

Issue 23478013: Major bench refactoring. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: merge with head agani Created 7 years, 3 months 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 | « bench/FontCacheBench.cpp ('k') | bench/GameBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBenchmark.h" 8 #include "SkBenchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGraphics.h" 10 #include "SkGraphics.h"
(...skipping 17 matching lines...) Expand all
28 protected: 28 protected:
29 virtual const char* onGetName() { return fName.c_str(); } 29 virtual const char* onGetName() { return fName.c_str(); }
30 virtual void onDraw(SkCanvas* canvas) { 30 virtual void onDraw(SkCanvas* canvas) {
31 SkPaint paint; 31 SkPaint paint;
32 this->setupPaint(&paint); 32 this->setupPaint(&paint);
33 paint.setLCDRenderText(fDoLCD); 33 paint.setLCDRenderText(fDoLCD);
34 34
35 bool prev = gSkSuppressFontCachePurgeSpew; 35 bool prev = gSkSuppressFontCachePurgeSpew;
36 gSkSuppressFontCachePurgeSpew = true; 36 gSkSuppressFontCachePurgeSpew = true;
37 37
38 // this is critical - we want to time the creation process, so we 38 for (int i = 0; i < this->getLoops(); i++) {
39 // explicitly flush our cache before each run 39 // this is critical - we want to time the creation process, so we
40 SkGraphics::PurgeFontCache(); 40 // explicitly flush our cache before each run
41 SkGraphics::PurgeFontCache();
41 42
42 for (int ps = 9; ps <= 24; ps += 2) { 43 for (int ps = 9; ps <= 24; ps += 2) {
43 paint.setTextSize(SkIntToScalar(ps)); 44 paint.setTextSize(SkIntToScalar(ps));
44 canvas->drawText(fText.c_str(), fText.size(), 45 canvas->drawText(fText.c_str(), fText.size(),
45 0, SkIntToScalar(20), paint); 46 0, SkIntToScalar(20), paint);
47 }
46 } 48 }
47 49
48 gSkSuppressFontCachePurgeSpew = prev; 50 gSkSuppressFontCachePurgeSpew = prev;
49 } 51 }
50 private: 52 private:
51 typedef SkBenchmark INHERITED; 53 typedef SkBenchmark INHERITED;
52 }; 54 };
53 55
54 /////////////////////////////////////////////////////////////////////////////// 56 ///////////////////////////////////////////////////////////////////////////////
55 57
56 static SkBenchmark* Fact0(void* p) { return SkNEW_ARGS(FontScalerBench, (p, fals e)); } 58 static SkBenchmark* Fact0(void* p) { return SkNEW_ARGS(FontScalerBench, (p, fals e)); }
57 static SkBenchmark* Fact1(void* p) { return SkNEW_ARGS(FontScalerBench, (p, true )); } 59 static SkBenchmark* Fact1(void* p) { return SkNEW_ARGS(FontScalerBench, (p, true )); }
58 60
59 static BenchRegistry gReg0(Fact0); 61 static BenchRegistry gReg0(Fact0);
60 static BenchRegistry gReg1(Fact1); 62 static BenchRegistry gReg1(Fact1);
OLDNEW
« no previous file with comments | « bench/FontCacheBench.cpp ('k') | bench/GameBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698