Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: src/core/SkTSort.h

Issue 12316141: Sort GL extension strings and search to find. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 /** Sorts the region from left to right using comparator '<' using a Quick Sort algorithm. */ 198 /** Sorts the region from left to right using comparator '<' using a Quick Sort algorithm. */
199 template <typename T> void SkTQSort(T* left, T* right) { 199 template <typename T> void SkTQSort(T* left, T* right) {
200 SkTQSort(left, right, SkTCompareLT<T>()); 200 SkTQSort(left, right, SkTCompareLT<T>());
201 } 201 }
202 202
203 /** Sorts the region from left to right using comparator '* < *' using a Quick S ort algorithm. */ 203 /** Sorts the region from left to right using comparator '* < *' using a Quick S ort algorithm. */
204 template <typename T> void SkTQSort(T** left, T** right) { 204 template <typename T> void SkTQSort(T** left, T** right) {
205 SkTQSort(left, right, SkTPointerCompareLT<T>()); 205 SkTQSort(left, right, SkTPointerCompareLT<T>());
206 } 206 }
207 207
208 /** Adapts an SkTSearch comparison function to a SkTSort functor */
reed1 2013/02/26 23:05:44 Why is the functor called COMPARE instead of LT or
bsalomon 2013/02/27 16:56:36 Done, and made the comment a bit more explicit abo
209 template <typename T, int (COMPARE)(const T*, const T*)>
210 class SkTSearchCompareFunctor {
211 public:
212 bool operator()(const T& a, const T& b) {
213 return COMPARE(&a, &b) < 0;
214 }
215 };
216
217
208 #endif 218 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698