From f08d1d0ce19c72bb911f059dcf916cf99a0a2467 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Mon, 18 Jun 2018 15:11:00 -0400 Subject: Stop using SkTSwap. Use std::swap instead. It does not appear that any external user specializes SkTSwap, but some may still use it. This removes all use in Skia so that SkTSwap can later be removed in a smaller CL. After that the include can be removed from SkTypes.h. Change-Id: If03d4ee07dbecda961aa9f0dc34d171ef5168753 Reviewed-on: https://skia-review.googlesource.com/135578 Reviewed-by: Hal Canary Reviewed-by: Mike Klein Commit-Queue: Ben Wagner --- include/core/SkRect.h | 12 ++++++++---- include/core/SkString.h | 4 +--- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'include/core') diff --git a/include/core/SkRect.h b/include/core/SkRect.h index b33b0b9ac9..ed0e599ad9 100644 --- a/include/core/SkRect.h +++ b/include/core/SkRect.h @@ -23,6 +23,8 @@ #include "../private/SkSafe32.h" #include "../private/SkTFitsIn.h" +#include + struct SkRect; /** \struct SkIRect @@ -646,11 +648,12 @@ struct SK_API SkIRect { and width() and height() will be zero or positive. */ void sort() { + using std::swap; if (fLeft > fRight) { - SkTSwap(fLeft, fRight); + swap(fLeft, fRight); } if (fTop > fBottom) { - SkTSwap(fTop, fBottom); + swap(fTop, fBottom); } } @@ -1519,12 +1522,13 @@ public: and width() and height() will be zero or positive. */ void sort() { + using std::swap; if (fLeft > fRight) { - SkTSwap(fLeft, fRight); + swap(fLeft, fRight); } if (fTop > fBottom) { - SkTSwap(fTop, fBottom); + swap(fTop, fBottom); } } diff --git a/include/core/SkString.h b/include/core/SkString.h index aa3292abfe..300d9ed8ef 100644 --- a/include/core/SkString.h +++ b/include/core/SkString.h @@ -274,9 +274,7 @@ SkString SkStringPrintf(const char* format, ...); /// optional. static inline SkString SkStringPrintf() { return SkString(); } -// 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) { +static inline void swap(SkString& a, SkString& b) { a.swap(b); } -- cgit v1.2.3