| 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 "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
| 9 #include "SkBitmapDevice.h" | 9 #include "SkBitmapDevice.h" |
| 10 #include "SkBlurImageFilter.h" | 10 #include "SkBlurImageFilter.h" |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
| 13 #include "SkRandom.h" | 13 #include "SkRandom.h" |
| 14 #include "SkShader.h" | 14 #include "SkShader.h" |
| 15 #include "SkString.h" | 15 #include "SkString.h" |
| 16 | 16 |
| 17 #define FILTER_WIDTH_SMALL 32 | 17 #define FILTER_WIDTH_SMALL 32 |
| 18 #define FILTER_HEIGHT_SMALL 32 | 18 #define FILTER_HEIGHT_SMALL 32 |
| 19 #define FILTER_WIDTH_LARGE 256 | 19 #define FILTER_WIDTH_LARGE 256 |
| 20 #define FILTER_HEIGHT_LARGE 256 | 20 #define FILTER_HEIGHT_LARGE 256 |
| 21 #define BLUR_SIGMA_SMALL 1.0f | 21 #define BLUR_SIGMA_SMALL 1.0f |
| 22 #define BLUR_SIGMA_LARGE 10.0f | 22 #define BLUR_SIGMA_LARGE 10.0f |
| 23 #define BLUR_SIGMA_HUGE 80.0f |
| 23 | 24 |
| 24 class BlurImageFilterBench : public SkBenchmark { | 25 class BlurImageFilterBench : public SkBenchmark { |
| 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)); |
| 30 } | 31 } |
| 31 | 32 |
| 32 protected: | 33 protected: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, 0, false);) | 88 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, 0, false);) |
| 88 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, 0, false);) | 89 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, 0, false);) |
| 89 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false);) | 90 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false);) |
| 90 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false);) | 91 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false);) |
| 91 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);) |
| 92 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);) |
| 93 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);) |
| 94 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);) |
| 96 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, true
);) |
| 97 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, fals
e);) |
| OLD | NEW |