On 2016-04-21 08:55:46 +0200, Hans Verkuil wrote:
> 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.

Thanks I'm about to send out a v5 so this was good timing. I did just 
discover one odd behavior in the driver I would like to look in to 
today. But will include the v4l2-rect.h helpers in v5.

-- 
Regards,
Niklas Söderlund
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to