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 "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 public: | 304 public: |
305 enum LineType { | 305 enum LineType { |
306 kHori_LineType, | 306 kHori_LineType, |
307 kVert_LineType, | 307 kVert_LineType, |
308 kDiag_LineType, | 308 kDiag_LineType, |
309 kLineTypeCount | 309 kLineTypeCount |
310 }; | 310 }; |
311 | 311 |
312 static const char* LineTypeName(LineType lt) { | 312 static const char* LineTypeName(LineType lt) { |
313 static const char* gNames[] = { "hori", "vert", "diag" }; | 313 static const char* gNames[] = { "hori", "vert", "diag" }; |
314 SK_COMPILE_ASSERT(kLineTypeCount == SK_ARRAY_COUNT(gNames), names_wrong_
size); | 314 static_assert(kLineTypeCount == SK_ARRAY_COUNT(gNames), "names_wrong_siz
e"); |
315 return gNames[lt]; | 315 return gNames[lt]; |
316 } | 316 } |
317 | 317 |
318 GiantDashBench(LineType lt, SkScalar width) { | 318 GiantDashBench(LineType lt, SkScalar width) { |
319 fName.printf("giantdashline_%s_%g", LineTypeName(lt), width); | 319 fName.printf("giantdashline_%s_%g", LineTypeName(lt), width); |
320 fStrokeWidth = width; | 320 fStrokeWidth = width; |
321 | 321 |
322 // deliberately pick intervals that won't be caught by asPoints(), so | 322 // deliberately pick intervals that won't be caught by asPoints(), so |
323 // we can test the filterPath code-path. | 323 // we can test the filterPath code-path. |
324 const SkScalar intervals[] = { 20, 10, 10, 10 }; | 324 const SkScalar intervals[] = { 20, 10, 10, 10 }; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 // hori_2 is just too slow to enable at the moment | 479 // hori_2 is just too slow to enable at the moment |
480 DEF_BENCH( return new GiantDashBench(GiantDashBench::kHori_LineType, 2); ) | 480 DEF_BENCH( return new GiantDashBench(GiantDashBench::kHori_LineType, 2); ) |
481 DEF_BENCH( return new GiantDashBench(GiantDashBench::kVert_LineType, 2); ) | 481 DEF_BENCH( return new GiantDashBench(GiantDashBench::kVert_LineType, 2); ) |
482 DEF_BENCH( return new GiantDashBench(GiantDashBench::kDiag_LineType, 2); ) | 482 DEF_BENCH( return new GiantDashBench(GiantDashBench::kDiag_LineType, 2); ) |
483 | 483 |
484 DEF_BENCH( return new DashGridBench(1, 1, true); ) | 484 DEF_BENCH( return new DashGridBench(1, 1, true); ) |
485 DEF_BENCH( return new DashGridBench(1, 1, false); ) | 485 DEF_BENCH( return new DashGridBench(1, 1, false); ) |
486 DEF_BENCH( return new DashGridBench(3, 1, true); ) | 486 DEF_BENCH( return new DashGridBench(3, 1, true); ) |
487 DEF_BENCH( return new DashGridBench(3, 1, false); ) | 487 DEF_BENCH( return new DashGridBench(3, 1, false); ) |
488 #endif | 488 #endif |
OLD | NEW |