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" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 virtual void onPreDraw() SK_OVERRIDE { | 38 virtual void onPreDraw() SK_OVERRIDE { |
39 if (!fInitialized) { | 39 if (!fInitialized) { |
40 make_checkerboard(); | 40 make_checkerboard(); |
41 fInitialized = true; | 41 fInitialized = true; |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { | 45 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { |
46 SkPaint paint; | 46 SkPaint paint; |
47 paint.setImageFilter(new SkBlurImageFilter(fSigmaX, fSigmaY))->unref(); | 47 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY))->unref
(); |
48 | 48 |
49 for (int i = 0; i < loops; i++) { | 49 for (int i = 0; i < loops; i++) { |
50 canvas->drawBitmap(fCheckerboard, 0, 0, &paint); | 50 canvas->drawBitmap(fCheckerboard, 0, 0, &paint); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 private: | 54 private: |
55 void make_checkerboard() { | 55 void make_checkerboard() { |
56 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; | 56 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; |
57 const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE; | 57 const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE; |
(...skipping 30 matching lines...) Expand all Loading... |
88 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, 0, false);) | 88 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, 0, false);) |
89 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, 0, false);) | 89 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, 0, false);) |
90 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false);) | 90 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false);) |
91 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false);) | 91 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false);) |
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, tr
ue);) |
93 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);) |
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, tr
ue);) |
95 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
);) | 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);) | 97 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, fals
e);) |
OLD | NEW |