OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
| 7 |
7 #include "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
8 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
9 #include "SkPaint.h" | 10 #include "SkPaint.h" |
10 #include "SkRandom.h" | 11 #include "SkRandom.h" |
11 #include "SkShader.h" | 12 #include "SkShader.h" |
12 #include "SkString.h" | 13 #include "SkString.h" |
13 #include "SkMorphologyImageFilter.h" | 14 #include "SkMorphologyImageFilter.h" |
14 | 15 |
15 #define SMALL SkIntToScalar(2) | 16 #define SMALL SkIntToScalar(2) |
16 #define REAL SkFloatToScalar(1.5f) | 17 #define REAL SkFloatToScalar(1.5f) |
17 #define BIG SkIntToScalar(10) | 18 #define BIG SkIntToScalar(10) |
18 | 19 |
19 namespace { | |
20 | |
21 enum MorphologyType { | 20 enum MorphologyType { |
22 kErode_MT, | 21 kErode_MT, |
23 kDilate_MT | 22 kDilate_MT |
24 }; | 23 }; |
25 | 24 |
26 } | |
27 | |
28 static const char* gStyleName[] = { | 25 static const char* gStyleName[] = { |
29 "erode", | 26 "erode", |
30 "dilate" | 27 "dilate" |
31 }; | 28 }; |
32 | 29 |
33 class MorphologyBench : public SkBenchmark { | 30 class MorphologyBench : public SkBenchmark { |
34 SkScalar fRadius; | 31 SkScalar fRadius; |
35 MorphologyType fStyle; | 32 MorphologyType fStyle; |
36 SkString fName; | 33 SkString fName; |
37 | 34 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 DEF_BENCH( return new MorphologyBench(SMALL, kDilate_MT); ) | 91 DEF_BENCH( return new MorphologyBench(SMALL, kDilate_MT); ) |
95 | 92 |
96 DEF_BENCH( return new MorphologyBench(BIG, kErode_MT); ) | 93 DEF_BENCH( return new MorphologyBench(BIG, kErode_MT); ) |
97 DEF_BENCH( return new MorphologyBench(BIG, kDilate_MT); ) | 94 DEF_BENCH( return new MorphologyBench(BIG, kDilate_MT); ) |
98 | 95 |
99 DEF_BENCH( return new MorphologyBench(REAL, kErode_MT); ) | 96 DEF_BENCH( return new MorphologyBench(REAL, kErode_MT); ) |
100 DEF_BENCH( return new MorphologyBench(REAL, kDilate_MT); ) | 97 DEF_BENCH( return new MorphologyBench(REAL, kDilate_MT); ) |
101 | 98 |
102 DEF_BENCH( return new MorphologyBench(0, kErode_MT); ) | 99 DEF_BENCH( return new MorphologyBench(0, kErode_MT); ) |
103 #endif | 100 #endif |
OLD | NEW |