Lines Matching full:r

15  * @r: rect whose width and height fields will be set
18 static inline void v4l2_rect_set_size_to(struct v4l2_rect *r, in v4l2_rect_set_size_to() argument
21 r->width = size->width; in v4l2_rect_set_size_to()
22 r->height = size->height; in v4l2_rect_set_size_to()
26 * v4l2_rect_set_min_size() - width and height of r should be >= min_size.
27 * @r: rect whose width and height will be modified
30 static inline void v4l2_rect_set_min_size(struct v4l2_rect *r, in v4l2_rect_set_min_size() argument
33 if (r->width < min_size->width) in v4l2_rect_set_min_size()
34 r->width = min_size->width; in v4l2_rect_set_min_size()
35 if (r->height < min_size->height) in v4l2_rect_set_min_size()
36 r->height = min_size->height; in v4l2_rect_set_min_size()
40 * v4l2_rect_set_max_size() - width and height of r should be <= max_size
41 * @r: rect whose width and height will be modified
44 static inline void v4l2_rect_set_max_size(struct v4l2_rect *r, in v4l2_rect_set_max_size() argument
47 if (r->width > max_size->width) in v4l2_rect_set_max_size()
48 r->width = max_size->width; in v4l2_rect_set_max_size()
49 if (r->height > max_size->height) in v4l2_rect_set_max_size()
50 r->height = max_size->height; in v4l2_rect_set_max_size()
54 * v4l2_rect_map_inside()- r should be inside boundary.
55 * @r: rect that will be modified
56 * @boundary: rect containing the boundary for @r
58 static inline void v4l2_rect_map_inside(struct v4l2_rect *r, in v4l2_rect_map_inside() argument
61 v4l2_rect_set_max_size(r, boundary); in v4l2_rect_map_inside()
62 if (r->left < boundary->left) in v4l2_rect_map_inside()
63 r->left = boundary->left; in v4l2_rect_map_inside()
64 if (r->top < boundary->top) in v4l2_rect_map_inside()
65 r->top = boundary->top; in v4l2_rect_map_inside()
66 if (r->left + r->width > boundary->left + boundary->width) in v4l2_rect_map_inside()
67 r->left = boundary->left + boundary->width - r->width; in v4l2_rect_map_inside()
68 if (r->top + r->height > boundary->top + boundary->height) in v4l2_rect_map_inside()
69 r->top = boundary->top + boundary->height - r->height; in v4l2_rect_map_inside()
113 * @r: intersection of @r1 and @r2.
117 static inline void v4l2_rect_intersect(struct v4l2_rect *r, in v4l2_rect_intersect() argument
123 r->top = max(r1->top, r2->top); in v4l2_rect_intersect()
124 r->left = max(r1->left, r2->left); in v4l2_rect_intersect()
127 r->height = max(0, bottom - r->top); in v4l2_rect_intersect()
128 r->width = max(0, right - r->left); in v4l2_rect_intersect()
132 * v4l2_rect_scale() - scale rect r by to/from
133 * @r: rect to be scaled.
137 * This scales rectangle @r horizontally by @to->width / @from->width and
140 * Typically @r is a rectangle inside @from and you want the rectangle as
141 * it would appear after scaling @from to @to. So the resulting @r will
144 static inline void v4l2_rect_scale(struct v4l2_rect *r, in v4l2_rect_scale() argument
149 r->left = r->top = r->width = r->height = 0; in v4l2_rect_scale()
152 r->left = (((r->left - from->left) * to->width) / from->width) & ~1; in v4l2_rect_scale()
153 r->width = ((r->width * to->width) / from->width) & ~1; in v4l2_rect_scale()
154 r->top = ((r->top - from->top) * to->height) / from->height; in v4l2_rect_scale()
155 r->height = (r->height * to->height) / from->height; in v4l2_rect_scale()