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 "SkBenchmark.h" |
9 #include "SkRandom.h" | 9 #include "SkRandom.h" |
10 #include "SkTSort.h" | 10 #include "SkTSort.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 }; | 97 }; |
98 | 98 |
99 class SortBench : public SkBenchmark { | 99 class SortBench : public SkBenchmark { |
100 SkString fName; | 100 SkString fName; |
101 const Type fType; | 101 const Type fType; |
102 const SortProc fSortProc; | 102 const SortProc fSortProc; |
103 SkAutoTMalloc<int> fUnsorted; | 103 SkAutoTMalloc<int> fUnsorted; |
104 | 104 |
105 public: | 105 public: |
106 SortBench(Type t, SortType s) : fType(t), fSortProc(gSorts[s].fProc) { | 106 SortBench(Type t, SortType s) : fType(t), fSortProc(gSorts[s].fProc) { |
107 fIsRendering = false; | |
108 fName.printf("sort_%s_%s", gSorts[s].fName, gRec[t].fName); | 107 fName.printf("sort_%s_%s", gSorts[s].fName, gRec[t].fName); |
109 } | 108 } |
110 | 109 |
| 110 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { |
| 111 return backend == kNonRendering_Backend; |
| 112 } |
| 113 |
111 protected: | 114 protected: |
112 virtual const char* onGetName() SK_OVERRIDE { | 115 virtual const char* onGetName() SK_OVERRIDE { |
113 return fName.c_str(); | 116 return fName.c_str(); |
114 } | 117 } |
115 | 118 |
116 // Delayed initialization only done if onDraw will be called. | 119 // Delayed initialization only done if onDraw will be called. |
117 virtual void onPreDraw() SK_OVERRIDE { | 120 virtual void onPreDraw() SK_OVERRIDE { |
118 fUnsorted.reset(N); | 121 fUnsorted.reset(N); |
119 gRec[fType].fProc(fUnsorted.get()); | 122 gRec[fType].fProc(fUnsorted.get()); |
120 } | 123 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 DEF_BENCH( return NewSkHeap(kFore); ) | 163 DEF_BENCH( return NewSkHeap(kFore); ) |
161 DEF_BENCH( return NewQSort(kFore); ) | 164 DEF_BENCH( return NewQSort(kFore); ) |
162 | 165 |
163 DEF_BENCH( return NewSkQSort(kBack); ) | 166 DEF_BENCH( return NewSkQSort(kBack); ) |
164 DEF_BENCH( return NewSkHeap(kBack); ) | 167 DEF_BENCH( return NewSkHeap(kBack); ) |
165 DEF_BENCH( return NewQSort(kBack); ) | 168 DEF_BENCH( return NewQSort(kBack); ) |
166 | 169 |
167 DEF_BENCH( return NewSkQSort(kSame); ) | 170 DEF_BENCH( return NewSkQSort(kSame); ) |
168 DEF_BENCH( return NewSkHeap(kSame); ) | 171 DEF_BENCH( return NewSkHeap(kSame); ) |
169 DEF_BENCH( return NewQSort(kSame); ) | 172 DEF_BENCH( return NewQSort(kSame); ) |
OLD | NEW |