diff options
author | Marco Felsch <m.felsch@pengutronix.de> | 2018-06-28 19:20:37 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-09-17 20:25:41 +0300 |
commit | e62fdbb24c342f78e431e05925097165cc0e05e9 (patch) | |
tree | ef0d2e85a16d142616e855d0c5d36f7451379e9c /include/media/v4l2-rect.h | |
parent | 8a7441baccd4ce85e34a0a500824900d2b58a4b0 (diff) | |
download | linux-e62fdbb24c342f78e431e05925097165cc0e05e9.tar.xz |
media: v4l2-rect.h: add position and equal helpers
Add two helper functions to check if two rectangles have the same
position (top/left) and if two rectangles equals (same size and
same position).
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'include/media/v4l2-rect.h')
-rw-r--r-- | include/media/v4l2-rect.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/media/v4l2-rect.h b/include/media/v4l2-rect.h index 595c3ba05f23..c86474dc7b55 100644 --- a/include/media/v4l2-rect.h +++ b/include/media/v4l2-rect.h @@ -83,6 +83,32 @@ static inline bool v4l2_rect_same_size(const struct v4l2_rect *r1, } /** + * v4l2_rect_same_position() - return true if r1 has the same position as r2 + * @r1: rectangle. + * @r2: rectangle. + * + * Return true if both rectangles have the same position + */ +static inline bool v4l2_rect_same_position(const struct v4l2_rect *r1, + const struct v4l2_rect *r2) +{ + return r1->top == r2->top && r1->left == r2->left; +} + +/** + * v4l2_rect_equal() - return true if r1 equals r2 + * @r1: rectangle. + * @r2: rectangle. + * + * Return true if both rectangles have the same size and position. + */ +static inline bool v4l2_rect_equal(const struct v4l2_rect *r1, + const struct v4l2_rect *r2) +{ + return v4l2_rect_same_size(r1, r2) && v4l2_rect_same_position(r1, r2); +} + +/** * v4l2_rect_intersect() - calculate the intersection of two rects. * @r: intersection of @r1 and @r2. * @r1: rectangle. |