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 "Benchmark.h" |
| 9 #include "SkBicubicImageFilter.h" |
9 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
10 #include "SkShader.h" | 11 #include "SkShader.h" |
11 #include "SkString.h" | 12 #include "SkString.h" |
12 #include "SkBicubicImageFilter.h" | |
13 | 13 |
14 // This bench exercises SkBicubicImageFilter, upsampling a 40x40 input to | 14 // This bench exercises SkBicubicImageFilter, upsampling a 40x40 input to |
15 // 100x100, 400x100, 100x400, and 400x400. | 15 // 100x100, 400x100, 100x400, and 400x400. |
16 | 16 |
17 class BicubicBench : public SkBenchmark { | 17 class BicubicBench : public Benchmark { |
18 SkSize fScale; | 18 SkSize fScale; |
19 SkString fName; | 19 SkString fName; |
20 | 20 |
21 public: | 21 public: |
22 BicubicBench(float x, float y) | 22 BicubicBench(float x, float y) |
23 : fScale(SkSize::Make(x, y)) { | 23 : fScale(SkSize::Make(x, y)) { |
24 fName.printf("bicubic_%gx%g", | 24 fName.printf("bicubic_%gx%g", |
25 SkScalarToFloat(fScale.fWidth), SkScalarToFloat(fScale.fHei
ght)); | 25 SkScalarToFloat(fScale.fWidth), SkScalarToFloat(fScale.fHei
ght)); |
26 } | 26 } |
27 | 27 |
(...skipping 14 matching lines...) Expand all Loading... |
42 | 42 |
43 for (int i = 0; i < loops; i++) { | 43 for (int i = 0; i < loops; i++) { |
44 canvas->save(); | 44 canvas->save(); |
45 canvas->clipRect(r); | 45 canvas->clipRect(r); |
46 canvas->drawOval(r, paint); | 46 canvas->drawOval(r, paint); |
47 canvas->restore(); | 47 canvas->restore(); |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 private: | 51 private: |
52 typedef SkBenchmark INHERITED; | 52 typedef Benchmark INHERITED; |
53 }; | 53 }; |
54 | 54 |
55 DEF_BENCH( return new BicubicBench(10.0f, 10.0f); ) | 55 DEF_BENCH( return new BicubicBench(10.0f, 10.0f); ) |
56 DEF_BENCH( return new BicubicBench(2.5f, 10.0f); ) | 56 DEF_BENCH( return new BicubicBench(2.5f, 10.0f); ) |
57 DEF_BENCH( return new BicubicBench(10.0f, 2.5f); ) | 57 DEF_BENCH( return new BicubicBench(10.0f, 2.5f); ) |
58 DEF_BENCH( return new BicubicBench(2.5f, 2.5f); ) | 58 DEF_BENCH( return new BicubicBench(2.5f, 2.5f); ) |
OLD | NEW |