Skip to content

Commit fa3ab5c

Browse files
sherginfacebook-github-bot
authored andcommitted
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
1 parent d5ec68f commit fa3ab5c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ReactCommon/fabric/graphics/Geometry.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,26 @@ struct RectangleEdges {
141141
}
142142
};
143143

144+
template <typename T>
145+
RectangleEdges<T> operator+(
146+
RectangleEdges<T> const &lhs,
147+
RectangleEdges<T> const &rhs) {
148+
return RectangleEdges<T>{lhs.left + rhs.left,
149+
lhs.top + rhs.top,
150+
lhs.right + rhs.right,
151+
lhs.bottom + rhs.bottom};
152+
}
153+
154+
template <typename T>
155+
RectangleEdges<T> operator-(
156+
RectangleEdges<T> const &lhs,
157+
RectangleEdges<T> const &rhs) {
158+
return RectangleEdges<T>{lhs.left - rhs.left,
159+
lhs.top - rhs.top,
160+
lhs.right - rhs.right,
161+
lhs.bottom - rhs.bottom};
162+
}
163+
144164
/*
145165
* Generic data structure describes some values associated with *corners*
146166
* of a rectangle.

0 commit comments

Comments
 (0)