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

Side by Side Diff: bench/ShaderMaskBench.cpp

Issue 347823004: Remove Sk prefix from some bench classes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkGMBench -> GMBench Created 6 years, 6 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/ScalarBench.cpp ('k') | bench/SkBenchLogger.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SkBenchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorShader.h" 10 #include "SkColorShader.h"
11 #include "SkFontHost.h" 11 #include "SkFontHost.h"
12 #include "SkPaint.h" 12 #include "SkPaint.h"
13 #include "SkRandom.h" 13 #include "SkRandom.h"
14 #include "SkString.h" 14 #include "SkString.h"
15 #include "SkTemplates.h" 15 #include "SkTemplates.h"
16 16
17 #define STR "Hamburgefons" 17 #define STR "Hamburgefons"
18 18
19 enum FontQuality { 19 enum FontQuality {
20 kBW, 20 kBW,
21 kAA, 21 kAA,
22 kLCD 22 kLCD
23 }; 23 };
24 24
25 static const char* fontQualityName(const SkPaint& paint) { 25 static const char* fontQualityName(const SkPaint& paint) {
26 if (!paint.isAntiAlias()) { 26 if (!paint.isAntiAlias()) {
27 return "BW"; 27 return "BW";
28 } 28 }
29 if (paint.isLCDRenderText()) { 29 if (paint.isLCDRenderText()) {
30 return "LCD"; 30 return "LCD";
31 } 31 }
32 return "AA"; 32 return "AA";
33 } 33 }
34 34
35 class ShaderMaskBench : public SkBenchmark { 35 class ShaderMaskBench : public Benchmark {
36 SkPaint fPaint; 36 SkPaint fPaint;
37 SkString fText; 37 SkString fText;
38 SkString fName; 38 SkString fName;
39 FontQuality fFQ; 39 FontQuality fFQ;
40 public: 40 public:
41 ShaderMaskBench(bool isOpaque, FontQuality fq) { 41 ShaderMaskBench(bool isOpaque, FontQuality fq) {
42 fFQ = fq; 42 fFQ = fq;
43 fText.set(STR); 43 fText.set(STR);
44 44
45 fPaint.setAntiAlias(kBW != fq); 45 fPaint.setAntiAlias(kBW != fq);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 paint.setTextSize(SkIntToScalar(48)); 79 paint.setTextSize(SkIntToScalar(48));
80 for (int i = 0; i < loops / 4 ; i++) { 80 for (int i = 0; i < loops / 4 ; i++) {
81 SkScalar x = x0 + rand.nextUScalar1() * dim.fX; 81 SkScalar x = x0 + rand.nextUScalar1() * dim.fX;
82 SkScalar y = y0 + rand.nextUScalar1() * dim.fY; 82 SkScalar y = y0 + rand.nextUScalar1() * dim.fY;
83 canvas->drawText(fText.c_str(), fText.size(), x, y, paint); 83 canvas->drawText(fText.c_str(), fText.size(), x, y, paint);
84 } 84 }
85 } 85 }
86 86
87 private: 87 private:
88 typedef SkBenchmark INHERITED; 88 typedef Benchmark INHERITED;
89 }; 89 };
90 90
91 /////////////////////////////////////////////////////////////////////////////// 91 ///////////////////////////////////////////////////////////////////////////////
92 92
93 DEF_BENCH( return new ShaderMaskBench(true, kBW); ) 93 DEF_BENCH( return new ShaderMaskBench(true, kBW); )
94 DEF_BENCH( return new ShaderMaskBench(false, kBW); ) 94 DEF_BENCH( return new ShaderMaskBench(false, kBW); )
95 DEF_BENCH( return new ShaderMaskBench(true, kAA); ) 95 DEF_BENCH( return new ShaderMaskBench(true, kAA); )
96 DEF_BENCH( return new ShaderMaskBench(false, kAA); ) 96 DEF_BENCH( return new ShaderMaskBench(false, kAA); )
97 DEF_BENCH( return new ShaderMaskBench(true, kLCD); ) 97 DEF_BENCH( return new ShaderMaskBench(true, kLCD); )
98 DEF_BENCH( return new ShaderMaskBench(false, kLCD); ) 98 DEF_BENCH( return new ShaderMaskBench(false, kLCD); )
OLDNEW
« no previous file with comments | « bench/ScalarBench.cpp ('k') | bench/SkBenchLogger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698