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" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 void onDraw(const int loops, SkCanvas* canvas) override { | 45 void onDraw(const int loops, SkCanvas* canvas) override { |
46 SkPaint paint; | 46 SkPaint paint; |
47 static const SkScalar kX = 0; | 47 static const SkScalar kX = 0; |
48 static const SkScalar kY = 0; | 48 static const SkScalar kY = 0; |
49 const SkRect bmpRect = SkRect::MakeXYWH(kX, kY, | 49 const SkRect bmpRect = SkRect::MakeXYWH(kX, kY, |
50 SkIntToScalar(fCheckerboard.widt
h()), | 50 SkIntToScalar(fCheckerboard.widt
h()), |
51 SkIntToScalar(fCheckerboard.heig
ht())); | 51 SkIntToScalar(fCheckerboard.heig
ht())); |
52 const SkImageFilter::CropRect cropRect = | 52 const SkImageFilter::CropRect cropRect = |
53 SkImageFilter::CropRect(bmpRect.makeInse
t(10.f, 10.f)); | 53 SkImageFilter::CropRect(bmpRect.makeInse
t(10.f, 10.f)); |
54 const SkImageFilter::CropRect* crop = fIsCropped ? &cropRect : NULL; | 54 const SkImageFilter::CropRect* crop = fIsCropped ? &cropRect : nullptr; |
55 | 55 |
56 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY, NULL, c
rop))->unref(); | 56 paint.setImageFilter(SkBlurImageFilter::Create(fSigmaX, fSigmaY, nullptr
, crop))->unref(); |
57 | 57 |
58 for (int i = 0; i < loops; i++) { | 58 for (int i = 0; i < loops; i++) { |
59 canvas->drawBitmap(fCheckerboard, kX, kY, &paint); | 59 canvas->drawBitmap(fCheckerboard, kX, kY, &paint); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 private: | 63 private: |
64 void make_checkerboard() { | 64 void make_checkerboard() { |
65 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; | 65 const int w = fIsSmall ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE; |
66 const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE; | 66 const int h = fIsSmall ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false, true);) | 111 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_LARGE, false, true);) |
112 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false, true);) | 112 DEF_BENCH(return new BlurImageFilterBench(0, BLUR_SIGMA_SMALL, false, true);) |
113 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, true
, true);) | 113 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, true
, true);) |
114 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, fals
e, true);) | 114 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_MINI, BLUR_SIGMA_MINI, fals
e, true);) |
115 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, tr
ue, true);) | 115 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, tr
ue, true);) |
116 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, fa
lse, true);) | 116 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_SMALL, BLUR_SIGMA_SMALL, fa
lse, true);) |
117 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, tr
ue, true);) | 117 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, tr
ue, true);) |
118 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, fa
lse, true);) | 118 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_LARGE, BLUR_SIGMA_LARGE, fa
lse, true);) |
119 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, true
, true);) | 119 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, true
, true);) |
120 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, fals
e, true);) | 120 DEF_BENCH(return new BlurImageFilterBench(BLUR_SIGMA_HUGE, BLUR_SIGMA_HUGE, fals
e, true);) |
OLD | NEW |