OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Create a chain of ImageFilters from colorFilters | 32 // Create a chain of ImageFilters from colorFilters |
33 fImageFilter = nullptr; | 33 fImageFilter = nullptr; |
34 for(int i = nFilters; i --> 0;) { | 34 for(int i = nFilters; i --> 0;) { |
35 SkAutoTUnref<SkImageFilter> filter( | 35 SkAutoTUnref<SkImageFilter> filter( |
36 SkColorFilterImageFilter::Create(colorFilters[i], fImage
Filter, nullptr) | 36 SkColorFilterImageFilter::Create(colorFilters[i], fImage
Filter, nullptr) |
37 ); | 37 ); |
38 SkRefCnt_SafeAssign(fImageFilter, filter.get()); | 38 SkRefCnt_SafeAssign(fImageFilter, filter.get()); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 void onDraw(const int loops, SkCanvas* canvas) override { | 42 void onDraw(int loops, SkCanvas* canvas) override { |
43 makeBitmap(); | 43 makeBitmap(); |
44 | 44 |
45 for(int i = 0; i < loops; i++) { | 45 for(int i = 0; i < loops; i++) { |
46 SkPaint paint; | 46 SkPaint paint; |
47 paint.setImageFilter(fImageFilter); | 47 paint.setImageFilter(fImageFilter); |
48 canvas->drawBitmap(fBitmap, 0, 0, &paint); | 48 canvas->drawBitmap(fBitmap, 0, 0, &paint); |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 doPreDraw(colorFilters, SK_ARRAY_COUNT(colorFilters)); | 149 doPreDraw(colorFilters, SK_ARRAY_COUNT(colorFilters)); |
150 | 150 |
151 for(unsigned i = 0; i < SK_ARRAY_COUNT(colorFilters); i++) { | 151 for(unsigned i = 0; i < SK_ARRAY_COUNT(colorFilters); i++) { |
152 colorFilters[i]->unref(); | 152 colorFilters[i]->unref(); |
153 } | 153 } |
154 } | 154 } |
155 }; | 155 }; |
156 | 156 |
157 DEF_BENCH(return new TableCollapseBench;) | 157 DEF_BENCH(return new TableCollapseBench;) |
158 DEF_BENCH(return new MatrixCollapseBench;) | 158 DEF_BENCH(return new MatrixCollapseBench;) |
OLD | NEW |