OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkTSort_DEFINED | 10 #ifndef SkTSort_DEFINED |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 /** Sorts the region from left to right using comparator '<' using a Quick Sort
algorithm. */ | 200 /** Sorts the region from left to right using comparator '<' using a Quick Sort
algorithm. */ |
201 template <typename T> void SkTQSort(T* left, T* right) { | 201 template <typename T> void SkTQSort(T* left, T* right) { |
202 SkTQSort(left, right, SkTCompareLT<T>()); | 202 SkTQSort(left, right, SkTCompareLT<T>()); |
203 } | 203 } |
204 | 204 |
205 /** Sorts the region from left to right using comparator '* < *' using a Quick S
ort algorithm. */ | 205 /** Sorts the region from left to right using comparator '* < *' using a Quick S
ort algorithm. */ |
206 template <typename T> void SkTQSort(T** left, T** right) { | 206 template <typename T> void SkTQSort(T** left, T** right) { |
207 SkTQSort(left, right, SkTPointerCompareLT<T>()); | 207 SkTQSort(left, right, SkTPointerCompareLT<T>()); |
208 } | 208 } |
209 | 209 |
210 /** Adapts a tri-state SkTSearch comparison function to a bool less-than SkTSort
functor */ | |
211 template <typename T, int (COMPARE)(const T*, const T*)> | |
212 class SkTSearchCompareLTFunctor { | |
213 public: | |
214 bool operator()(const T& a, const T& b) { | |
215 return COMPARE(&a, &b) < 0; | |
216 } | |
217 }; | |
218 | |
219 | |
220 #endif | 210 #endif |
OLD | NEW |