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

Side by Side Diff: bench/FontCacheBench.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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
« no previous file with comments | « bench/FSRectBench.cpp ('k') | bench/GMBench.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 /* 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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkChecksum.h" 10 #include "SkChecksum.h"
(...skipping 10 matching lines...) Expand all
21 curr += 1; 21 curr += 1;
22 } 22 }
23 return static_cast<int>(curr - start); 23 return static_cast<int>(curr - start);
24 } 24 }
25 25
26 class FontCacheBench : public Benchmark { 26 class FontCacheBench : public Benchmark {
27 public: 27 public:
28 FontCacheBench() {} 28 FontCacheBench() {}
29 29
30 protected: 30 protected:
31 virtual const char* onGetName() SK_OVERRIDE { 31 const char* onGetName() SK_OVERRIDE {
32 return "fontcache"; 32 return "fontcache";
33 } 33 }
34 34
35 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { 35 void onDraw(const int loops, 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);
39 39
40 const uint16_t* array = gUniqueGlyphIDs; 40 const uint16_t* array = gUniqueGlyphIDs;
41 while (*array != gUniqueGlyphIDs_Sentinel) { 41 while (*array != gUniqueGlyphIDs_Sentinel) {
42 int count = count_glyphs(array); 42 int count = count_glyphs(array);
43 for (int i = 0; i < loops; ++i) { 43 for (int i = 0; i < loops; ++i) {
44 paint.measureText(array, count * sizeof(uint16_t)); 44 paint.measureText(array, count * sizeof(uint16_t));
45 } 45 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 class FontCacheEfficiency : public Benchmark { 99 class FontCacheEfficiency : public Benchmark {
100 public: 100 public:
101 FontCacheEfficiency() { 101 FontCacheEfficiency() {
102 if (false) dump_array(NULL, 0); 102 if (false) dump_array(NULL, 0);
103 if (false) rotr(0, 0); 103 if (false) rotr(0, 0);
104 } 104 }
105 105
106 protected: 106 protected:
107 virtual const char* onGetName() SK_OVERRIDE { 107 const char* onGetName() SK_OVERRIDE {
108 return "fontefficiency"; 108 return "fontefficiency";
109 } 109 }
110 110
111 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { 111 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
112 static bool gDone; 112 static bool gDone;
113 if (gDone) { 113 if (gDone) {
114 return; 114 return;
115 } 115 }
116 gDone = true; 116 gDone = true;
117 117
118 for (int hashBits = 6; hashBits <= 12; hashBits += 1) { 118 for (int hashBits = 6; hashBits <= 12; hashBits += 1) {
119 int hashMask = ((1 << hashBits) - 1); 119 int hashMask = ((1 << hashBits) - 1);
120 for (int limit = 32; limit <= 1024; limit <<= 1) { 120 for (int limit = 32; limit <= 1024; limit <<= 1) {
121 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { 121 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
(...skipping 16 matching lines...) Expand all
138 private: 138 private:
139 typedef Benchmark INHERITED; 139 typedef Benchmark INHERITED;
140 }; 140 };
141 141
142 /////////////////////////////////////////////////////////////////////////////// 142 ///////////////////////////////////////////////////////////////////////////////
143 143
144 DEF_BENCH( return new FontCacheBench(); ) 144 DEF_BENCH( return new FontCacheBench(); )
145 145
146 // undefine this to run the efficiency test 146 // undefine this to run the efficiency test
147 //DEF_BENCH( return new FontCacheEfficiency(); ) 147 //DEF_BENCH( return new FontCacheEfficiency(); )
OLDNEW
« no previous file with comments | « bench/FSRectBench.cpp ('k') | bench/GMBench.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698