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

Side by Side Diff: bench/ShaderMaskBench.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/ScalarBench.cpp ('k') | bench/SkBenchmark.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 "SkBenchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorShader.h" 10 #include "SkColorShader.h"
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 return "AA"; 32 return "AA";
33 } 33 }
34 34
35 class ShaderMaskBench : public SkBenchmark { 35 class ShaderMaskBench : public SkBenchmark {
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(void* param, bool isOpaque, FontQuality fq) : INHERITED(para m) { 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);
46 fPaint.setLCDRenderText(kLCD == fq); 46 fPaint.setLCDRenderText(kLCD == fq);
47 fPaint.setAlpha(isOpaque ? 0xFF : 0x80); 47 fPaint.setAlpha(isOpaque ? 0xFF : 0x80);
48 fPaint.setShader(new SkColorShader)->unref(); 48 fPaint.setShader(new SkColorShader)->unref();
49 } 49 }
50 50
51 protected: 51 protected:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 canvas->drawText(fText.c_str(), fText.size(), x, y, paint); 84 canvas->drawText(fText.c_str(), fText.size(), x, y, paint);
85 } 85 }
86 } 86 }
87 87
88 private: 88 private:
89 typedef SkBenchmark INHERITED; 89 typedef SkBenchmark INHERITED;
90 }; 90 };
91 91
92 /////////////////////////////////////////////////////////////////////////////// 92 ///////////////////////////////////////////////////////////////////////////////
93 93
94 static SkBenchmark* Fact00(void* p) { return new ShaderMaskBench(p, true, kBW); } 94 DEF_BENCH( return new ShaderMaskBench(true, kBW); )
95 static SkBenchmark* Fact01(void* p) { return new ShaderMaskBench(p, false, kBW); } 95 DEF_BENCH( return new ShaderMaskBench(false, kBW); )
96 static SkBenchmark* Fact10(void* p) { return new ShaderMaskBench(p, true, kAA); } 96 DEF_BENCH( return new ShaderMaskBench(true, kAA); )
97 static SkBenchmark* Fact11(void* p) { return new ShaderMaskBench(p, false, kAA); } 97 DEF_BENCH( return new ShaderMaskBench(false, kAA); )
98 static SkBenchmark* Fact20(void* p) { return new ShaderMaskBench(p, true, kLCD) ; } 98 DEF_BENCH( return new ShaderMaskBench(true, kLCD); )
99 static SkBenchmark* Fact21(void* p) { return new ShaderMaskBench(p, false, kLCD) ; } 99 DEF_BENCH( return new ShaderMaskBench(false, kLCD); )
100
101 static BenchRegistry gReg00(Fact00);
102 static BenchRegistry gReg01(Fact01);
103 static BenchRegistry gReg10(Fact10);
104 static BenchRegistry gReg11(Fact11);
105 static BenchRegistry gReg20(Fact20);
106 static BenchRegistry gReg21(Fact21);
OLDNEW
« no previous file with comments | « bench/ScalarBench.cpp ('k') | bench/SkBenchmark.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698