Commit e62fdbb2 authored by Marco Felsch's avatar Marco Felsch Committed by Mauro Carvalho Chehab

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: default avatarMarco Felsch <m.felsch@pengutronix.de>
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 8a7441ba
......@@ -82,6 +82,32 @@ static inline bool v4l2_rect_same_size(const struct v4l2_rect *r1,
return r1->width == r2->width && r1->height == r2->height;
}
/**
* 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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment