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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkColorFilter.h" | 12 #include "SkColorFilter.h" |
13 #include "SkLayerDrawLooper.h" | 13 #include "SkLayerDrawLooper.h" |
14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
15 #include "SkPath.h" | 15 #include "SkPath.h" |
16 #include "SkPoint.h" | 16 #include "SkPoint.h" |
17 #include "SkRRect.h" | 17 #include "SkRRect.h" |
18 #include "SkRect.h" | 18 #include "SkRect.h" |
19 #include "SkString.h" | 19 #include "SkString.h" |
20 #include "SkXfermode.h" | 20 #include "SkXfermode.h" |
21 | 21 |
22 // Large blurred RR appear frequently on web pages. This benchmark measures our | 22 // Large blurred RR appear frequently on web pages. This benchmark measures our |
23 // performance in this case. | 23 // performance in this case. |
24 class BlurRoundRectBench : public Benchmark { | 24 class BlurRoundRectBench : public Benchmark { |
25 public: | 25 public: |
26 BlurRoundRectBench(int width, int height, int cornerRadius) | 26 BlurRoundRectBench(int width, int height, int cornerRadius) |
27 : fName("blurroundrect") { | 27 : fName("blurroundrect") { |
28 fName.appendf("_WH[%ix%i]_cr[%i]", width, height, cornerRadius); | 28 fName.appendf("_WH_%ix%i_cr_%i", width, height, cornerRadius); |
29 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); | 29 SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); |
30 fRRect.setRectXY(r, SkIntToScalar(cornerRadius), SkIntToScalar(cornerRad
ius)); | 30 fRRect.setRectXY(r, SkIntToScalar(cornerRadius), SkIntToScalar(cornerRad
ius)); |
31 } | 31 } |
32 | 32 |
33 const char* onGetName() override { | 33 const char* onGetName() override { |
34 return fName.c_str(); | 34 return fName.c_str(); |
35 } | 35 } |
36 | 36 |
37 SkIPoint onGetSize() override { | 37 SkIPoint onGetSize() override { |
38 return SkIPoint::Make(SkScalarCeilToInt(fRRect.rect().width()), | 38 return SkIPoint::Make(SkScalarCeilToInt(fRRect.rect().width()), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 typedef Benchmark INHERITED; | 81 typedef Benchmark INHERITED; |
82 }; | 82 }; |
83 | 83 |
84 // Create one with dimensions/rounded corners based on the skp | 84 // Create one with dimensions/rounded corners based on the skp |
85 DEF_BENCH(return new BlurRoundRectBench(600, 5514, 6);) | 85 DEF_BENCH(return new BlurRoundRectBench(600, 5514, 6);) |
86 // Same radii, much smaller rectangle | 86 // Same radii, much smaller rectangle |
87 DEF_BENCH(return new BlurRoundRectBench(100, 100, 6);) | 87 DEF_BENCH(return new BlurRoundRectBench(100, 100, 6);) |
88 // Other radii options | 88 // Other radii options |
89 DEF_BENCH(return new BlurRoundRectBench(100, 100, 30);) | 89 DEF_BENCH(return new BlurRoundRectBench(100, 100, 30);) |
90 DEF_BENCH(return new BlurRoundRectBench(100, 100, 90);) | 90 DEF_BENCH(return new BlurRoundRectBench(100, 100, 90);) |
OLD | NEW |