OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 |
8 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
11 #include "SkPaint.h" | 11 #include "SkPaint.h" |
12 #include "SkRandom.h" | 12 #include "SkRandom.h" |
13 #include "SkShader.h" | 13 #include "SkShader.h" |
14 #include "SkString.h" | 14 #include "SkString.h" |
15 | 15 |
16 #define FILTER_WIDTH_SMALL 32 | 16 #define FILTER_WIDTH_SMALL 32 |
17 #define FILTER_HEIGHT_SMALL 32 | 17 #define FILTER_HEIGHT_SMALL 32 |
18 #define FILTER_WIDTH_LARGE 256 | 18 #define FILTER_WIDTH_LARGE 256 |
19 #define FILTER_HEIGHT_LARGE 256 | 19 #define FILTER_HEIGHT_LARGE 256 |
| 20 #define BLUR_SIGMA_MINI 0.5f |
20 #define BLUR_SIGMA_SMALL 1.0f | 21 #define BLUR_SIGMA_SMALL 1.0f |
21 #define BLUR_SIGMA_LARGE 10.0f | 22 #define BLUR_SIGMA_LARGE 10.0f |
22 #define BLUR_SIGMA_HUGE 80.0f | 23 #define BLUR_SIGMA_HUGE 80.0f |
23 | 24 |
24 class BlurImageFilterBench : public Benchmark { | 25 class BlurImageFilterBench : public Benchmark { |
25 public: | 26 public: |
26 BlurImageFilterBench(SkScalar sigmaX, SkScalar sigmaY, bool small) : | 27 BlurImageFilterBench(SkScalar sigmaX, SkScalar sigmaY, bool small) : |
27 fIsSmall(small), fInitialized(false), fSigmaX(sigmaX), fSigmaY(sigmaY) { | 28 fIsSmall(small), fInitialized(false), fSigmaX(sigmaX), fSigmaY(sigmaY) { |
28 fName.printf("blur_image_filter_%s_%.2f_%.2f", fIsSmall ? "small" : "lar
ge", | 29 fName.printf("blur_image_filter_%s_%.2f_%.2f", fIsSmall ? "small" : "lar
ge", |
29 SkScalarToFloat(sigmaX), SkScalarToFloat(sigmaY)); | 30 SkScalarToFloat(sigmaX), SkScalarToFloat(sigmaY)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 bool fInitialized; | 80 bool fInitialized; |
80 SkBitmap fCheckerboard; | 81 SkBitmap fCheckerboard; |
81 SkScalar fSigmaX, fSigmaY; | 82 SkScalar fSigmaX, fSigmaY; |
82 typedef Benchmark INHERITED; | 83 typedef Benchmark INHERITED; |
83 }; | 84 }; |
84 | 85 |
85 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, 0, false);) | 86 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, 0, false);) |
86 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, 0, false);) | 87 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, 0, false);) |
87 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false);) | 88 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false);) |
88 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false);) | 89 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false);) |
| 90 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, true
);) |
| 91 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, fals
e);) |
89 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, tr
ue);) | 92 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, tr
ue);) |
90 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, fa
lse);) | 93 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, fa
lse);) |
91 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, tr
ue);) | 94 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, tr
ue);) |
92 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, fa
lse);) | 95 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, fa
lse);) |
93 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, true
);) | 96 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, true
);) |
94 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, fals
e);) | 97 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, fals
e);) |
OLD | NEW |