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

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

Issue 15070011: One SkTSearch to rule them all. Allow key to be of different type than the array. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fixes to compile on gcc Created 7 years, 7 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
« no previous file with comments | « src/core/SkPtrRecorder.cpp ('k') | src/gpu/effects/GrTextureStripAtlas.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/core/SkPtrRecorder.cpp ('k') | src/gpu/effects/GrTextureStripAtlas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698