diff options
author | 2013-02-27 19:07:32 +0000 | |
---|---|---|
committer | 2013-02-27 19:07:32 +0000 | |
commit | ff436617d8f11297f0eff93ddd49fb9022d0843b (patch) | |
tree | ede5235583e98991ed75f5fece72137ad0711115 /include | |
parent | f0e92f3814677084e8d61f6c83f5625fa6c4780c (diff) |
Sort GL extension strings and search to find.
Review URL: https://codereview.chromium.org/12316141
git-svn-id: http://skia.googlecode.com/svn/trunk@7889 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkString.h | 6 | ||||
-rw-r--r-- | include/core/SkTypes.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/include/core/SkString.h b/include/core/SkString.h index 4a6e2aa4e0..4366630ef2 100644 --- a/include/core/SkString.h +++ b/include/core/SkString.h @@ -244,4 +244,10 @@ private: /// Creates a new string and writes into it using a printf()-style format. SkString SkStringPrintf(const char* format, ...); +// Specialized to take advantage of SkString's fast swap path. The unspecialized function is +// declared in SkTypes.h and called by SkTSort. +template <> inline void SkTSwap(SkString& a, SkString& b) { + a.swap(b); +} + #endif diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index cbba50cc1b..ae27089bf7 100644 --- a/include/core/SkTypes.h +++ b/include/core/SkTypes.h @@ -276,6 +276,8 @@ static inline int Sk32ToBool(uint32_t n) { return (n | (0-n)) >> 31; } +/** Generic swap function. Classes with efficient swaps should specialize this function to take + their fast path. This function is used by SkTSort. */ template <typename T> inline void SkTSwap(T& a, T& b) { T c(a); a = b; |