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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkImageSource.h" | 10 #include "SkImageSource.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 void onDelayedSetup() override { | 28 void onDelayedSetup() override { |
29 if (!fInitialized) { | 29 if (!fInitialized) { |
30 make_bitmap(); | 30 make_bitmap(); |
31 make_checkerboard(); | 31 make_checkerboard(); |
32 fInitialized = true; | 32 fInitialized = true; |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
36 void onDraw(const int loops, SkCanvas* canvas) override { | 36 void onDraw(int loops, SkCanvas* canvas) override { |
37 SkRect r = fIsSmall ? SkRect::MakeWH(FILTER_WIDTH_SMALL, FILTER_HEIGHT_S
MALL) : | 37 SkRect r = fIsSmall ? SkRect::MakeWH(FILTER_WIDTH_SMALL, FILTER_HEIGHT_S
MALL) : |
38 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_L
ARGE); | 38 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_L
ARGE); |
39 SkPaint paint; | 39 SkPaint paint; |
40 paint.setImageFilter(mergeBitmaps())->unref(); | 40 paint.setImageFilter(mergeBitmaps())->unref(); |
41 for (int i = 0; i < loops; i++) { | 41 for (int i = 0; i < loops; i++) { |
42 canvas->drawRect(r, paint); | 42 canvas->drawRect(r, paint); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 private: | 46 private: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 bool fInitialized; | 89 bool fInitialized; |
90 SkAutoTUnref<SkImage> fImage, fCheckerboard; | 90 SkAutoTUnref<SkImage> fImage, fCheckerboard; |
91 | 91 |
92 typedef Benchmark INHERITED; | 92 typedef Benchmark INHERITED; |
93 }; | 93 }; |
94 | 94 |
95 /////////////////////////////////////////////////////////////////////////////// | 95 /////////////////////////////////////////////////////////////////////////////// |
96 | 96 |
97 DEF_BENCH( return new MergeBench(true); ) | 97 DEF_BENCH( return new MergeBench(true); ) |
98 DEF_BENCH( return new MergeBench(false); ) | 98 DEF_BENCH( return new MergeBench(false); ) |
OLD | NEW |