Fabric: Add and subtract operations for RectangleEdges<T>

Summary:
We will use it soon for `EdgeInsets`

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18444732

fbshipit-source-id: f03aa2a8889d426095a954d88f9cb6172c3e376e
This commit is contained in:
Valentin Shergin
2019-11-13 14:19:59 -08:00
committed by Facebook Github Bot
parent d5ec68f841
commit fa3ab5c653
+20
View File
@@ -141,6 +141,26 @@ struct RectangleEdges {
}
};
template <typename T>
RectangleEdges<T> operator+(
RectangleEdges<T> const &lhs,
RectangleEdges<T> const &rhs) {
return RectangleEdges<T>{lhs.left + rhs.left,
lhs.top + rhs.top,
lhs.right + rhs.right,
lhs.bottom + rhs.bottom};
}
template <typename T>
RectangleEdges<T> operator-(
RectangleEdges<T> const &lhs,
RectangleEdges<T> const &rhs) {
return RectangleEdges<T>{lhs.left - rhs.left,
lhs.top - rhs.top,
lhs.right - rhs.right,
lhs.bottom - rhs.bottom};
}
/*
* Generic data structure describes some values associated with *corners*
* of a rectangle.