| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 | 8 |
| 9 #ifndef SkTSort_DEFINED | 9 #ifndef SkTSort_DEFINED |
| 10 #define SkTSort_DEFINED | 10 #define SkTSort_DEFINED |
| 11 | 11 |
| 12 #include "SkTypes.h" | 12 #include "SkTypes.h" |
| 13 #include "SkMath.h" | 13 #include "SkMathPriv.h" |
| 14 | 14 |
| 15 /* A comparison functor which performs the comparison 'a < b'. */ | 15 /* A comparison functor which performs the comparison 'a < b'. */ |
| 16 template <typename T> struct SkTCompareLT { | 16 template <typename T> struct SkTCompareLT { |
| 17 bool operator()(const T a, const T b) const { return a < b; } | 17 bool operator()(const T a, const T b) const { return a < b; } |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 /* A comparison functor which performs the comparison '*a < *b'. */ | 20 /* A comparison functor which performs the comparison '*a < *b'. */ |
| 21 template <typename T> struct SkTPointerCompareLT { | 21 template <typename T> struct SkTPointerCompareLT { |
| 22 bool operator()(const T* a, const T* b) const { return *a < *b; } | 22 bool operator()(const T* a, const T* b) const { return *a < *b; } |
| 23 }; | 23 }; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 template <typename T> void SkTQSort(T* left, T* right) { | 200 template <typename T> void SkTQSort(T* left, T* right) { |
| 201 SkTQSort(left, right, SkTCompareLT<T>()); | 201 SkTQSort(left, right, SkTCompareLT<T>()); |
| 202 } | 202 } |
| 203 | 203 |
| 204 /** Sorts the region from left to right using comparator '* < *' using a Quick S
ort algorithm. */ | 204 /** Sorts the region from left to right using comparator '* < *' using a Quick S
ort algorithm. */ |
| 205 template <typename T> void SkTQSort(T** left, T** right) { | 205 template <typename T> void SkTQSort(T** left, T** right) { |
| 206 SkTQSort(left, right, SkTPointerCompareLT<T>()); | 206 SkTQSort(left, right, SkTPointerCompareLT<T>()); |
| 207 } | 207 } |
| 208 | 208 |
| 209 #endif | 209 #endif |
| OLD | NEW |