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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/gl/GrGLExtensions.h ('k') | src/gpu/gl/GrGLExtensions.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkTSort.h
===================================================================
--- src/core/SkTSort.h (revision 7872)
+++ src/core/SkTSort.h (working copy)
@@ -92,7 +92,8 @@
array[root-1] = x;
}
-/** Sorts the array of size count using comparator lessThan using a Heap Sort algorithm
+/** Sorts the array of size count using comparator lessThan using a Heap Sort algorithm. Be sure to
+ * specialize SkTSwap if T has an efficient swap operation.
*
* @param array the array to be sorted.
* @param count the number of elements in the array.
@@ -180,7 +181,8 @@
}
}
-/** Sorts the region from left to right using comparator lessThan using a Quick Sort algorithm.
+/** Sorts the region from left to right using comparator lessThan using a Quick Sort algorithm. Be
+ * sure to specialize SkTSwap if T has an efficient swap operation.
*
* @param left the beginning of the region to be sorted.
* @param right the end of the region to be sorted (inclusive).
@@ -205,4 +207,14 @@
SkTQSort(left, right, SkTPointerCompareLT<T>());
}
+/** Adapts a tri-state SkTSearch comparison function to a bool less-than SkTSort functor */
+template <typename T, int (COMPARE)(const T*, const T*)>
+class SkTSearchCompareLTFunctor {
+public:
+ bool operator()(const T& a, const T& b) {
+ return COMPARE(&a, &b) < 0;
+ }
+};
+
+
#endif
« no previous file with comments | « include/gpu/gl/GrGLExtensions.h ('k') | src/gpu/gl/GrGLExtensions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698