remove unused sk_sp comparison operators
These unused comparison operators are the only users of <functional> in SkRefCnt.h, for std::less. <functional> is an expensive header to compile, and SkRefCnt.h is popular, so it helps to cut dependencies like this. Mostly we just need to add #include <functional> in a few places that were picking it up via SkRefCnt.h. In SkPixmapPriv.h, it looked simpler to template the argument, since everything was inline anyway. Change-Id: I7c125bb26a04199847357c729a1b178256c6ef8d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/236942 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
e2cbd947b7
commit
334a642b20
@ -65,3 +65,6 @@ Milestone 78
|
||||
|
||||
* SkMallocPixelRef: remove MakeDirect and MakeWithProc from API.
|
||||
https://review.skia.org/234660
|
||||
|
||||
* Remove unused sk_sp comparison operators.
|
||||
https://review.skia.org/236942
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "include/core/SkColor.h"
|
||||
#include "include/core/SkFlattenable.h"
|
||||
#include "include/core/SkPoint.h"
|
||||
#include <functional> // std::function
|
||||
|
||||
class SkArenaAlloc;
|
||||
class SkCanvas;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "include/core/SkShader.h"
|
||||
#include "include/core/SkTileMode.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
#include <functional> // std::function
|
||||
|
||||
#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
|
||||
#include <android/hardware_buffer.h>
|
||||
|
@ -10,13 +10,12 @@
|
||||
|
||||
#include "include/core/SkTypes.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <atomic> // std::atomic, std::memory_order_*
|
||||
#include <cstddef> // std::nullptr_t
|
||||
#include <iosfwd> // std::basic_ostream
|
||||
#include <memory> // TODO: unused
|
||||
#include <type_traits> // std::enable_if, std::is_convertible
|
||||
#include <utility> // std::forward, std::swap
|
||||
|
||||
/** \class SkRefCntBase
|
||||
|
||||
@ -344,49 +343,6 @@ template <typename T> inline bool operator!=(std::nullptr_t, const sk_sp<T>& b)
|
||||
return static_cast<bool>(b);
|
||||
}
|
||||
|
||||
template <typename T, typename U> inline bool operator<(const sk_sp<T>& a, const sk_sp<U>& b) {
|
||||
// Provide defined total order on sk_sp.
|
||||
// http://wg21.cmeerw.net/lwg/issue1297
|
||||
// http://wg21.cmeerw.net/lwg/issue1401 .
|
||||
return std::less<typename std::common_type<T*, U*>::type>()(a.get(), b.get());
|
||||
}
|
||||
template <typename T> inline bool operator<(const sk_sp<T>& a, std::nullptr_t) {
|
||||
return std::less<T*>()(a.get(), nullptr);
|
||||
}
|
||||
template <typename T> inline bool operator<(std::nullptr_t, const sk_sp<T>& b) {
|
||||
return std::less<T*>()(nullptr, b.get());
|
||||
}
|
||||
|
||||
template <typename T, typename U> inline bool operator<=(const sk_sp<T>& a, const sk_sp<U>& b) {
|
||||
return !(b < a);
|
||||
}
|
||||
template <typename T> inline bool operator<=(const sk_sp<T>& a, std::nullptr_t) {
|
||||
return !(nullptr < a);
|
||||
}
|
||||
template <typename T> inline bool operator<=(std::nullptr_t, const sk_sp<T>& b) {
|
||||
return !(b < nullptr);
|
||||
}
|
||||
|
||||
template <typename T, typename U> inline bool operator>(const sk_sp<T>& a, const sk_sp<U>& b) {
|
||||
return b < a;
|
||||
}
|
||||
template <typename T> inline bool operator>(const sk_sp<T>& a, std::nullptr_t) {
|
||||
return nullptr < a;
|
||||
}
|
||||
template <typename T> inline bool operator>(std::nullptr_t, const sk_sp<T>& b) {
|
||||
return b < nullptr;
|
||||
}
|
||||
|
||||
template <typename T, typename U> inline bool operator>=(const sk_sp<T>& a, const sk_sp<U>& b) {
|
||||
return !(a < b);
|
||||
}
|
||||
template <typename T> inline bool operator>=(const sk_sp<T>& a, std::nullptr_t) {
|
||||
return !(a < nullptr);
|
||||
}
|
||||
template <typename T> inline bool operator>=(std::nullptr_t, const sk_sp<T>& b) {
|
||||
return !(nullptr < b);
|
||||
}
|
||||
|
||||
template <typename C, typename CT, typename T>
|
||||
auto operator<<(std::basic_ostream<C, CT>& os, const sk_sp<T>& sp) -> decltype(os << sp.get()) {
|
||||
return os << sp.get();
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include "include/private/SkTArray.h"
|
||||
|
||||
#include <functional> // std::function
|
||||
#include <string.h>
|
||||
|
||||
struct SkCurve;
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "include/private/SkMutex.h"
|
||||
#include "src/core/SkLRUCache.h"
|
||||
#include <functional> // std::function
|
||||
|
||||
#define PARAGRAPH_CACHE_STATS
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "modules/skshaper/include/SkShaper.h"
|
||||
#include "src/core/SkSpan.h"
|
||||
#include "src/core/SkTraceEvent.h"
|
||||
#include <functional> // std::function
|
||||
|
||||
namespace skia {
|
||||
namespace textlayout {
|
||||
|
@ -32,8 +32,9 @@ public:
|
||||
* @param decode Function for decoding into a pixmap without
|
||||
* applying the origin.
|
||||
*/
|
||||
static bool Orient(const SkPixmap& dst, SkEncodedOrigin origin,
|
||||
std::function<bool(const SkPixmap&)> decode) {
|
||||
|
||||
template <typename Fn>
|
||||
static bool Orient(const SkPixmap& dst, SkEncodedOrigin origin, Fn&& decode) {
|
||||
SkAutoPixmapStorage storage;
|
||||
const SkPixmap* tmp = &dst;
|
||||
if (origin != kTopLeft_SkEncodedOrigin) {
|
||||
|
@ -10,7 +10,8 @@
|
||||
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/private/SkTHash.h"
|
||||
#include <vector>
|
||||
#include <functional> // std::hash
|
||||
#include <vector> // std::vector
|
||||
|
||||
namespace skvm {
|
||||
|
||||
@ -430,6 +431,7 @@ namespace skvm {
|
||||
static size_t Hash(T val) {
|
||||
return std::hash<T>{}(val);
|
||||
}
|
||||
// TODO: replace with SkOpts::hash()?
|
||||
size_t operator()(const Instruction& inst) const {
|
||||
return Hash((uint8_t)inst.op)
|
||||
^ Hash(inst.x)
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "include/core/SkColor.h"
|
||||
#include "include/core/SkPoint.h"
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include <functional> // std::function
|
||||
|
||||
class SkMatrix;
|
||||
class SkPath;
|
||||
|
@ -279,28 +279,13 @@ DEF_TEST(sk_sp, reporter) {
|
||||
REPORTER_ASSERT(reporter, nullptr == empty);
|
||||
REPORTER_ASSERT(reporter, empty == nullptr);
|
||||
REPORTER_ASSERT(reporter, empty == empty);
|
||||
|
||||
REPORTER_ASSERT(reporter, nullptr <= empty);
|
||||
REPORTER_ASSERT(reporter, empty <= nullptr);
|
||||
REPORTER_ASSERT(reporter, empty <= empty);
|
||||
|
||||
REPORTER_ASSERT(reporter, nullptr >= empty);
|
||||
REPORTER_ASSERT(reporter, empty >= nullptr);
|
||||
REPORTER_ASSERT(reporter, empty >= empty);
|
||||
}
|
||||
|
||||
{
|
||||
sk_sp<SkRefCnt> a = sk_make_sp<SkRefCnt>();
|
||||
sk_sp<SkRefCnt> b = sk_make_sp<SkRefCnt>();
|
||||
REPORTER_ASSERT(reporter, a != b);
|
||||
REPORTER_ASSERT(reporter, (a < b) != (b < a));
|
||||
REPORTER_ASSERT(reporter, (b > a) != (a > b));
|
||||
REPORTER_ASSERT(reporter, (a <= b) != (b <= a));
|
||||
REPORTER_ASSERT(reporter, (b >= a) != (a >= b));
|
||||
|
||||
REPORTER_ASSERT(reporter, a == a);
|
||||
REPORTER_ASSERT(reporter, a <= a);
|
||||
REPORTER_ASSERT(reporter, a >= a);
|
||||
}
|
||||
|
||||
// http://wg21.cmeerw.net/lwg/issue998
|
||||
|
Loading…
Reference in New Issue
Block a user