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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_L
ARGE); | 73 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_L
ARGE); |
74 SkPaint paint; | 74 SkPaint paint; |
75 paint.setImageFilter(this->mergeBitmaps()); | 75 paint.setImageFilter(this->mergeBitmaps()); |
76 for (int i = 0; i < loops; i++) { | 76 for (int i = 0; i < loops; i++) { |
77 canvas->drawRect(r, paint); | 77 canvas->drawRect(r, paint); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 private: | 81 private: |
82 sk_sp<SkImageFilter> mergeBitmaps() { | 82 sk_sp<SkImageFilter> mergeBitmaps() { |
83 sk_sp<SkImageFilter> first(SkImageSource::Create(fCheckerboard.get())); | 83 return SkMergeImageFilter::Make(SkImageSource::Make(fCheckerboard), |
84 sk_sp<SkImageFilter> second(SkImageSource::Create(fImage.get())); | 84 SkImageSource::Make(fImage)); |
85 return SkMergeImageFilter::Make(std::move(first), std::move(second)); | |
86 } | 85 } |
87 | 86 |
88 bool fIsSmall; | 87 bool fIsSmall; |
89 bool fInitialized; | 88 bool fInitialized; |
90 sk_sp<SkImage> fImage, fCheckerboard; | 89 sk_sp<SkImage> fImage, fCheckerboard; |
91 | 90 |
92 typedef Benchmark INHERITED; | 91 typedef Benchmark INHERITED; |
93 }; | 92 }; |
94 | 93 |
95 /////////////////////////////////////////////////////////////////////////////// | 94 /////////////////////////////////////////////////////////////////////////////// |
96 | 95 |
97 DEF_BENCH( return new MergeBench(true); ) | 96 DEF_BENCH( return new MergeBench(true); ) |
98 DEF_BENCH( return new MergeBench(false); ) | 97 DEF_BENCH( return new MergeBench(false); ) |
OLD | NEW |