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

Side by Side Diff: bench/FontCacheBench.cpp

Issue 23876006: Refactoring: get rid of the SkBenchmark void* parameter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: sync to head 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/FSRectBench.cpp ('k') | bench/FontScalerBench.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 2013 Google Inc. 2 * Copyright 2013 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 "SkFontHost.h" 10 #include "SkFontHost.h"
11 #include "SkPaint.h" 11 #include "SkPaint.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 #include "SkTemplates.h" 13 #include "SkTemplates.h"
14 14
15 #include "gUniqueGlyphIDs.h" 15 #include "gUniqueGlyphIDs.h"
16 #define gUniqueGlyphIDs_Sentinel 0xFFFF 16 #define gUniqueGlyphIDs_Sentinel 0xFFFF
17 17
18 static int count_glyphs(const uint16_t start[]) { 18 static int count_glyphs(const uint16_t start[]) {
19 const uint16_t* curr = start; 19 const uint16_t* curr = start;
20 while (*curr != gUniqueGlyphIDs_Sentinel) { 20 while (*curr != gUniqueGlyphIDs_Sentinel) {
21 curr += 1; 21 curr += 1;
22 } 22 }
23 return curr - start; 23 return curr - start;
24 } 24 }
25 25
26 class FontCacheBench : public SkBenchmark { 26 class FontCacheBench : public SkBenchmark {
27 public: 27 public:
28 FontCacheBench(void* param) : INHERITED(param) {} 28 FontCacheBench() {}
29 29
30 protected: 30 protected:
31 virtual const char* onGetName() SK_OVERRIDE { 31 virtual const char* onGetName() SK_OVERRIDE {
32 return "fontcache"; 32 return "fontcache";
33 } 33 }
34 34
35 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 35 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
36 SkPaint paint; 36 SkPaint paint;
37 this->setupPaint(&paint); 37 this->setupPaint(&paint);
38 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 38 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 static void dump_array(const uint16_t array[], int count) { 103 static void dump_array(const uint16_t array[], int count) {
104 for (int i = 0; i < count; ++i) { 104 for (int i = 0; i < count; ++i) {
105 SkDebugf(" %d,", array[i]); 105 SkDebugf(" %d,", array[i]);
106 } 106 }
107 SkDebugf("\n"); 107 SkDebugf("\n");
108 } 108 }
109 109
110 class FontCacheEfficiency : public SkBenchmark { 110 class FontCacheEfficiency : public SkBenchmark {
111 public: 111 public:
112 FontCacheEfficiency(void* param) : INHERITED(param) { 112 FontCacheEfficiency() {
113 if (false) dump_array(NULL, 0); 113 if (false) dump_array(NULL, 0);
114 if (false) rotr(0, 0); 114 if (false) rotr(0, 0);
115 } 115 }
116 116
117 protected: 117 protected:
118 virtual const char* onGetName() SK_OVERRIDE { 118 virtual const char* onGetName() SK_OVERRIDE {
119 return "fontefficiency"; 119 return "fontefficiency";
120 } 120 }
121 121
122 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 122 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
(...skipping 22 matching lines...) Expand all
145 } 145 }
146 } 146 }
147 } 147 }
148 148
149 private: 149 private:
150 typedef SkBenchmark INHERITED; 150 typedef SkBenchmark INHERITED;
151 }; 151 };
152 152
153 /////////////////////////////////////////////////////////////////////////////// 153 ///////////////////////////////////////////////////////////////////////////////
154 154
155 DEF_BENCH( return new FontCacheBench(p); ) 155 DEF_BENCH( return new FontCacheBench(); )
156 156
157 // undefine this to run the efficiency test 157 // undefine this to run the efficiency test
158 //DEF_BENCH( return new FontCacheEfficiency(p); ) 158 //DEF_BENCH( return new FontCacheEfficiency(); )
OLDNEW
« no previous file with comments | « bench/FSRectBench.cpp ('k') | bench/FontScalerBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698