OLD | NEW |
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 "SkFontHost.h" | 10 #include "SkFontHost.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 text -vs- postext - pathtext | 39 text -vs- postext - pathtext |
40 */ | 40 */ |
41 class TextBench : public SkBenchmark { | 41 class TextBench : public SkBenchmark { |
42 SkPaint fPaint; | 42 SkPaint fPaint; |
43 SkString fText; | 43 SkString fText; |
44 SkString fName; | 44 SkString fName; |
45 FontQuality fFQ; | 45 FontQuality fFQ; |
46 bool fDoPos; | 46 bool fDoPos; |
47 SkPoint* fPos; | 47 SkPoint* fPos; |
48 public: | 48 public: |
49 TextBench(void* param, const char text[], int ps, | 49 TextBench(const char text[], int ps, |
50 SkColor color, FontQuality fq, bool doPos = false) : INHERITED(par
am) { | 50 SkColor color, FontQuality fq, bool doPos = false) { |
51 fPos = NULL; | 51 fPos = NULL; |
52 fFQ = fq; | 52 fFQ = fq; |
53 fDoPos = doPos; | 53 fDoPos = doPos; |
54 fText.set(text); | 54 fText.set(text); |
55 | 55 |
56 fPaint.setAntiAlias(kBW != fq); | 56 fPaint.setAntiAlias(kBW != fq); |
57 fPaint.setLCDRenderText(kLCD == fq); | 57 fPaint.setLCDRenderText(kLCD == fq); |
58 fPaint.setTextSize(SkIntToScalar(ps)); | 58 fPaint.setTextSize(SkIntToScalar(ps)); |
59 fPaint.setColor(color); | 59 fPaint.setColor(color); |
60 | 60 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 private: | 125 private: |
126 typedef SkBenchmark INHERITED; | 126 typedef SkBenchmark INHERITED; |
127 }; | 127 }; |
128 | 128 |
129 /////////////////////////////////////////////////////////////////////////////// | 129 /////////////////////////////////////////////////////////////////////////////// |
130 | 130 |
131 #define STR "Hamburgefons" | 131 #define STR "Hamburgefons" |
132 | 132 |
133 static SkBenchmark* Fact01(void* p) { return new TextBench(p, STR, 16, 0xFF00000
0, kBW); } | 133 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kBW); ) |
134 static SkBenchmark* Fact02(void* p) { return new TextBench(p, STR, 16, 0xFFFF000
0, kBW); } | 134 DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kBW); ) |
135 static SkBenchmark* Fact03(void* p) { return new TextBench(p, STR, 16, 0x88FF000
0, kBW); } | 135 DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kBW); ) |
136 | 136 |
137 static SkBenchmark* Fact11(void* p) { return new TextBench(p, STR, 16, 0xFF00000
0, kAA); } | 137 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kAA); ) |
138 static SkBenchmark* Fact12(void* p) { return new TextBench(p, STR, 16, 0xFFFF000
0, kAA); } | 138 DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kAA); ) |
139 static SkBenchmark* Fact13(void* p) { return new TextBench(p, STR, 16, 0x88FF000
0, kAA); } | 139 DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kAA); ) |
140 | 140 |
141 static SkBenchmark* Fact21(void* p) { return new TextBench(p, STR, 16, 0xFF00000
0, kLCD); } | 141 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kLCD); ) |
142 static SkBenchmark* Fact22(void* p) { return new TextBench(p, STR, 16, 0xFFFF000
0, kLCD); } | 142 DEF_BENCH( return new TextBench(STR, 16, 0xFFFF0000, kLCD); ) |
143 static SkBenchmark* Fact23(void* p) { return new TextBench(p, STR, 16, 0x88FF000
0, kLCD); } | 143 DEF_BENCH( return new TextBench(STR, 16, 0x88FF0000, kLCD); ) |
144 | 144 |
145 static SkBenchmark* Fact111(void* p) { return new TextBench(p, STR, 16, 0xFF0000
00, kAA, true); } | 145 DEF_BENCH( return new TextBench(STR, 16, 0xFF000000, kAA, true); ) |
146 | |
147 static BenchRegistry gReg01(Fact01); | |
148 static BenchRegistry gReg02(Fact02); | |
149 static BenchRegistry gReg03(Fact03); | |
150 | |
151 static BenchRegistry gReg11(Fact11); | |
152 static BenchRegistry gReg12(Fact12); | |
153 static BenchRegistry gReg13(Fact13); | |
154 | |
155 static BenchRegistry gReg21(Fact21); | |
156 static BenchRegistry gReg22(Fact22); | |
157 static BenchRegistry gReg23(Fact23); | |
158 | |
159 static BenchRegistry gReg111(Fact111); | |
OLD | NEW |