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 "SkCommandLineFlags.h" | 10 #include "SkCommandLineFlags.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 protected: | 143 protected: |
144 virtual void onDraw(SkCanvas* canvas) { | 144 virtual void onDraw(SkCanvas* canvas) { |
145 SkScalar gSizes[] = { | 145 SkScalar gSizes[] = { |
146 SkIntToScalar(7), 0 | 146 SkIntToScalar(7), 0 |
147 }; | 147 }; |
148 size_t sizes = SK_ARRAY_COUNT(gSizes); | 148 size_t sizes = SK_ARRAY_COUNT(gSizes); |
149 | 149 |
150 if (FLAGS_strokeWidth >= 0) { | 150 if (FLAGS_strokeWidth >= 0) { |
151 gSizes[0] = FLAGS_strokeWidth; | 151 gSizes[0] = (SkScalar)FLAGS_strokeWidth; |
152 sizes = 1; | 152 sizes = 1; |
153 } | 153 } |
154 | 154 |
155 SkPaint paint; | 155 SkPaint paint; |
156 paint.setStrokeCap(SkPaint::kRound_Cap); | 156 paint.setStrokeCap(SkPaint::kRound_Cap); |
157 | 157 |
158 for (int loop = 0; loop < this->getLoops(); loop++) { | 158 for (int loop = 0; loop < this->getLoops(); loop++) { |
159 for (size_t i = 0; i < sizes; i++) { | 159 for (size_t i = 0; i < sizes; i++) { |
160 paint.setStrokeWidth(gSizes[i]); | 160 paint.setStrokeWidth(gSizes[i]); |
161 this->setupPaint(&paint); | 161 this->setupPaint(&paint); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 243 } |
244 | 244 |
245 protected: | 245 protected: |
246 virtual void onDraw(SkCanvas* canvas) { | 246 virtual void onDraw(SkCanvas* canvas) { |
247 SkScalar gSizes[] = { | 247 SkScalar gSizes[] = { |
248 SkIntToScalar(13), SkIntToScalar(24) | 248 SkIntToScalar(13), SkIntToScalar(24) |
249 }; | 249 }; |
250 size_t sizes = SK_ARRAY_COUNT(gSizes); | 250 size_t sizes = SK_ARRAY_COUNT(gSizes); |
251 | 251 |
252 if (FLAGS_strokeWidth >= 0) { | 252 if (FLAGS_strokeWidth >= 0) { |
253 gSizes[0] = FLAGS_strokeWidth; | 253 gSizes[0] = (SkScalar)FLAGS_strokeWidth; |
254 sizes = 1; | 254 sizes = 1; |
255 } | 255 } |
256 SkRandom rand; | 256 SkRandom rand; |
257 SkColor color = 0xFF000000; | 257 SkColor color = 0xFF000000; |
258 U8CPU alpha = 0xFF; | 258 U8CPU alpha = 0xFF; |
259 SkPaint paint; | 259 SkPaint paint; |
260 paint.setStrokeCap(SkPaint::kRound_Cap); | 260 paint.setStrokeCap(SkPaint::kRound_Cap); |
261 if (_type == KMaskShader) { | 261 if (_type == KMaskShader) { |
262 SkBitmap srcBM; | 262 SkBitmap srcBM; |
263 srcBM.setConfig(SkBitmap::kARGB_8888_Config, 10, 1); | 263 srcBM.setConfig(SkBitmap::kARGB_8888_Config, 10, 1); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 BlitMaskBench::kMaskBlack, "maskblack") | 334 BlitMaskBench::kMaskBlack, "maskblack") |
335 ); ) | 335 ); ) |
336 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench, | 336 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench, |
337 (p, SkCanvas::kPoints_PointMode, | 337 (p, SkCanvas::kPoints_PointMode, |
338 BlitMaskBench::kMaskColor, "maskcolor") | 338 BlitMaskBench::kMaskColor, "maskcolor") |
339 ); ) | 339 ); ) |
340 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench, | 340 DEF_BENCH( return SkNEW_ARGS(BlitMaskBench, |
341 (p, SkCanvas::kPoints_PointMode, | 341 (p, SkCanvas::kPoints_PointMode, |
342 BlitMaskBench::KMaskShader, "maskshader") | 342 BlitMaskBench::KMaskShader, "maskshader") |
343 ); ) | 343 ); ) |
OLD | NEW |