diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/renderengine/include/renderengine/LayerSettings.h | 12 | ||||
| -rw-r--r-- | libs/ui/include/ui/BlurRegion.h | 25 |
2 files changed, 24 insertions, 13 deletions
diff --git a/libs/renderengine/include/renderengine/LayerSettings.h b/libs/renderengine/include/renderengine/LayerSettings.h index bfb7465acf..ff4d112a26 100644 --- a/libs/renderengine/include/renderengine/LayerSettings.h +++ b/libs/renderengine/include/renderengine/LayerSettings.h @@ -194,18 +194,6 @@ static inline bool operator==(const ShadowSettings& lhs, const ShadowSettings& r lhs.length == rhs.length && lhs.casterIsTranslucent == rhs.casterIsTranslucent; } -static inline bool operator==(const BlurRegion& lhs, const BlurRegion& rhs) { - return lhs.alpha == rhs.alpha && lhs.cornerRadiusTL == rhs.cornerRadiusTL && - lhs.cornerRadiusTR == rhs.cornerRadiusTR && lhs.cornerRadiusBL == rhs.cornerRadiusBL && - lhs.cornerRadiusBR == rhs.cornerRadiusBR && lhs.blurRadius == rhs.blurRadius && - lhs.left == rhs.left && lhs.top == rhs.top && lhs.right == rhs.right && - lhs.bottom == rhs.bottom; -} - -static inline bool operator!=(const BlurRegion& lhs, const BlurRegion& rhs) { - return !(lhs == rhs); -} - static inline bool operator==(const LayerSettings& lhs, const LayerSettings& rhs) { if (lhs.blurRegions.size() != rhs.blurRegions.size()) { return false; diff --git a/libs/ui/include/ui/BlurRegion.h b/libs/ui/include/ui/BlurRegion.h index 69a586ecbb..a9ca369758 100644 --- a/libs/ui/include/ui/BlurRegion.h +++ b/libs/ui/include/ui/BlurRegion.h @@ -20,6 +20,8 @@ #include <iosfwd> #include <iostream> +#include <math/HashCombine.h> + namespace android { struct BlurRegion { @@ -33,6 +35,16 @@ struct BlurRegion { int top; int right; int bottom; + + inline bool operator==(const BlurRegion& other) const { + return blurRadius == other.blurRadius && cornerRadiusTL == other.cornerRadiusTL && + cornerRadiusTR == other.cornerRadiusTR && cornerRadiusBL == other.cornerRadiusBL && + cornerRadiusBR == other.cornerRadiusBR && alpha == other.alpha && + left == other.left && top == other.top && right == other.right && + bottom == other.bottom; + } + + inline bool operator!=(const BlurRegion& other) const { return !(*this == other); } }; static inline void PrintTo(const BlurRegion& blurRegion, ::std::ostream* os) { @@ -50,4 +62,15 @@ static inline void PrintTo(const BlurRegion& blurRegion, ::std::ostream* os) { *os << "\n}"; } -} // namespace android
\ No newline at end of file +} // namespace android + +namespace std { +template <> +struct hash<android::BlurRegion> { + size_t operator()(const android::BlurRegion& region) const { + return android::hashCombine(region.blurRadius, region.cornerRadiusTL, region.cornerRadiusTR, + region.cornerRadiusBL, region.cornerRadiusBR, region.alpha, + region.left, region.top, region.right, region.bottom); + } +}; +} // namespace std
\ No newline at end of file |