summaryrefslogtreecommitdiff
path: root/libs/ui/include/ui/FloatRect.h
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-10-07 16:57:34 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-10-07 16:57:34 +0000
commitb288e591b5546b00c17dc78634c87aeee6af4746 (patch)
tree1bca85935788654055cf665af42a53634cef23bf /libs/ui/include/ui/FloatRect.h
parent3ee6879e91eb132e0b24e2adefd4d8eae2491a62 (diff)
parent38afbfd13622e10b8e74b9c114fa05f30ba480bb (diff)
downloadnative-b288e591b5546b00c17dc78634c87aeee6af4746.tar.gz
Snap for 7803083 from 38afbfd13622e10b8e74b9c114fa05f30ba480bb to mainline-tzdata2-release
Change-Id: Ic05c46aa04f9072b3dc93e023a17408956f14474
Diffstat (limited to 'libs/ui/include/ui/FloatRect.h')
-rw-r--r--libs/ui/include/ui/FloatRect.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/ui/include/ui/FloatRect.h b/libs/ui/include/ui/FloatRect.h
index bec2552fde..4c9c7b7ef1 100644
--- a/libs/ui/include/ui/FloatRect.h
+++ b/libs/ui/include/ui/FloatRect.h
@@ -16,6 +16,7 @@
#pragma once
+#include <math/HashCombine.h>
#include <ostream>
namespace android {
@@ -48,6 +49,8 @@ public:
float top = 0.0f;
float right = 0.0f;
float bottom = 0.0f;
+
+ constexpr bool isEmpty() const { return !(left < right && top < bottom); }
};
inline bool operator==(const FloatRect& a, const FloatRect& b) {
@@ -60,3 +63,13 @@ static inline void PrintTo(const FloatRect& rect, ::std::ostream* os) {
}
} // namespace android
+
+namespace std {
+
+template <>
+struct hash<android::FloatRect> {
+ size_t operator()(const android::FloatRect& rect) const {
+ return android::hashCombine(rect.left, rect.top, rect.right, rect.bottom);
+ }
+};
+} // namespace std