On 04/12/2016 04:33 PM, Niklas Söderlund wrote:
> +static void rect_set_min_size(struct v4l2_rect *r,
> + const struct v4l2_rect *min_size)
> +{
> + if (r->width < min_size->width)
> + r->width = min_size->width;
> + if (r->height < min_size->height)
> + r->height = min_size->height;
> +}
> +
> +static void rect_set_max_size(struct v4l2_rect *r,
> + const struct v4l2_rect *max_size)
> +{
> + if (r->width > max_size->width)
> + r->width = max_size->width;
> + if (r->height > max_size->height)
> + r->height = max_size->height;
> +}
> +
> +static void rect_map_inside(struct v4l2_rect *r,
> + const struct v4l2_rect *boundary)
> +{
> + rect_set_max_size(r, boundary);
> +
> + if (r->left < boundary->left)
> + r->left = boundary->left;
> + if (r->top < boundary->top)
> + r->top = boundary->top;
> + if (r->left + r->width > boundary->width)
> + r->left = boundary->width - r->width;
> + if (r->top + r->height > boundary->height)
> + r->top = boundary->height - r->height;
> +}
> +
The v4l2-rect.h helpers have been merged, so you should be able to use
those for v5 and drop these functions here.
Regards,
Hans