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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 void onDraw(int loops, SkCanvas* canvas) override { | 67 void onDraw(int loops, SkCanvas* canvas) override { |
68 SkPaint paint; | 68 SkPaint paint; |
69 static const SkScalar kX = 0; | 69 static const SkScalar kX = 0; |
70 static const SkScalar kY = 0; | 70 static const SkScalar kY = 0; |
71 const SkRect bmpRect = SkRect::MakeXYWH(kX, kY, | 71 const SkRect bmpRect = SkRect::MakeXYWH(kX, kY, |
72 SkIntToScalar(fCheckerboard.widt
h()), | 72 SkIntToScalar(fCheckerboard.widt
h()), |
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 sk_sp<SkImageFilter> noOpCropped(SkOffsetImageFilter::Make(0, 0, nullptr
, &cropRect)); |
77 &cropRect)); | |
78 | 77 |
79 SkImageFilter* input = fIsExpanded ? noOpCropped.get() : nullptr; | 78 SkImageFilter* input = fIsExpanded ? noOpCropped.get() : nullptr; |
80 | 79 |
81 const SkImageFilter::CropRect* crop = | 80 const SkImageFilter::CropRect* crop = |
82 fIsExpanded ? &cropRectLarge : fIsCropped ? &cropRect : nullptr; | 81 fIsExpanded ? &cropRectLarge : fIsCropped ? &cropRect : nullptr; |
83 SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(fSigmaX, fSig
maY, input, crop)); | 82 SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(fSigmaX, fSig
maY, input, crop)); |
84 paint.setImageFilter(blur); | 83 paint.setImageFilter(blur); |
85 | 84 |
86 for (int i = 0; i < loops; i++) { | 85 for (int i = 0; i < loops; i++) { |
87 canvas->drawBitmap(fCheckerboard, kX, kY, &paint); | 86 canvas->drawBitmap(fCheckerboard, kX, kY, &paint); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false, true, true
);) | 152 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false, true, true
);) |
154 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false, true, true
);) | 153 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false, true, true
);) |
155 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, true
, true, true);) | 154 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, true
, true, true);) |
156 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, fals
e, true, true);) | 155 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, fals
e, true, true);) |
157 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, tr
ue, true, true);) | 156 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, tr
ue, true, true);) |
158 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, fa
lse, true, true);) | 157 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, fa
lse, true, true);) |
159 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, tr
ue, true, true);) | 158 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, tr
ue, true, true);) |
160 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, fa
lse, true, true);) | 159 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, fa
lse, true, true);) |
161 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, true
, true, true);) | 160 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, true
, true, true);) |
162 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, fals
e, true, true);) | 161 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, fals
e, true, true);) |
OLD | NEW |