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 "SkOffsetImageFilter.h" | 10 #include "SkOffsetImageFilter.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 SkIntToScalar(fCheckerboard.heig
ht())); | 73 SkIntToScalar(fCheckerboard.heig
ht())); |
74 const SkImageFilter::CropRect cropRect(bmpRect.makeInset(10.f, 10.f)); | 74 const SkImageFilter::CropRect cropRect(bmpRect.makeInset(10.f, 10.f)); |
75 const SkImageFilter::CropRect cropRectLarge(bmpRect); | 75 const SkImageFilter::CropRect cropRectLarge(bmpRect); |
76 SkAutoTUnref<SkImageFilter> noOpCropped(SkOffsetImageFilter::Create(0, 0
, nullptr, | 76 SkAutoTUnref<SkImageFilter> noOpCropped(SkOffsetImageFilter::Create(0, 0
, nullptr, |
77 &cropRect)); | 77 &cropRect)); |
78 | 78 |
79 SkImageFilter* input = fIsExpanded ? noOpCropped.get() : nullptr; | 79 SkImageFilter* input = fIsExpanded ? noOpCropped.get() : nullptr; |
80 | 80 |
81 const SkImageFilter::CropRect* crop = | 81 const SkImageFilter::CropRect* crop = |
82 fIsExpanded ? &cropRectLarge : fIsCropped ? &cropRect : nullptr; | 82 fIsExpanded ? &cropRectLarge : fIsCropped ? &cropRect : nullptr; |
83 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY, input,
crop))->unref(); | 83 SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(fSigmaX, fSig
maY, input, crop)); |
| 84 paint.setImageFilter(blur); |
84 | 85 |
85 for (int i = 0; i < loops; i++) { | 86 for (int i = 0; i < loops; i++) { |
86 canvas->drawBitmap(fCheckerboard, kX, kY, &paint); | 87 canvas->drawBitmap(fCheckerboard, kX, kY, &paint); |
87 } | 88 } |
88 } | 89 } |
89 | 90 |
90 private: | 91 private: |
91 void make_checkerboard() { | 92 void make_checkerboard() { |
92 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; | 93 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; |
93 const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE; | 94 const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false, true, true
);) | 153 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false, true, true
);) |
153 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false, true, true
);) | 154 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false, true, true
);) |
154 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, true
, true, true);) | 155 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, true
, true, true);) |
155 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, fals
e, true, true);) | 156 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, fals
e, true, true);) |
156 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, tr
ue, true, true);) | 157 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, tr
ue, true, true);) |
157 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, fa
lse, true, true);) | 158 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, fa
lse, true, true);) |
158 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, tr
ue, true, true);) | 159 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, tr
ue, true, true);) |
159 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, fa
lse, true, true);) | 160 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, fa
lse, true, true);) |
160 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, true
, true, true);) | 161 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, true
, true, true);) |
161 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, fals
e, true, true);) | 162 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, fals
e, true, true);) |
OLD | NEW |