Lines Matching +full:left +full:-

1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * v4l2-rect.h - v4l2_rect helper functions
14 * v4l2_rect_set_size_to() - copy the width/height values.
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.
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
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.
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()
73 * v4l2_rect_same_size() - return true if r1 has the same size as r2
82 return r1->width == r2->width && r1->height == r2->height; in v4l2_rect_same_size()
86 * v4l2_rect_same_position() - return true if r1 has the same position as r2
95 return r1->top == r2->top && r1->left == r2->left; in v4l2_rect_same_position()
99 * v4l2_rect_equal() - return true if r1 equals r2
112 * v4l2_rect_intersect() - calculate the intersection of two rects.
123 r->top = max(r1->top, r2->top); in v4l2_rect_intersect()
124 r->left = max(r1->left, r2->left); in v4l2_rect_intersect()
125 bottom = min(r1->top + r1->height, r2->top + r2->height); in v4l2_rect_intersect()
126 right = min(r1->left + r1->width, r2->left + r2->width); 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
137 * This scales rectangle @r horizontally by @to->width / @from->width and
138 * vertically by @to->height / @from->height.
148 if (from->width == 0 || from->height == 0) { in v4l2_rect_scale()
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()
159 * v4l2_rect_overlap() - do r1 and r2 overlap?
169 * IF the left side of r1 is to the right of the right side of r2 OR in v4l2_rect_overlap()
170 * the left side of r2 is to the right of the right side of r1 THEN in v4l2_rect_overlap()
173 if (r1->left >= r2->left + r2->width || in v4l2_rect_overlap()
174 r2->left >= r1->left + r1->width) in v4l2_rect_overlap()
181 if (r1->top >= r2->top + r2->height || in v4l2_rect_overlap()
182 r2->top >= r1->top + r1->height) in v4l2_rect_overlap()
188 * v4l2_rect_enclosed() - is r1 enclosed in r2?
197 if (r1->left < r2->left || r1->top < r2->top) in v4l2_rect_enclosed()
199 if (r1->left + r1->width > r2->left + r2->width) in v4l2_rect_enclosed()
201 if (r1->top + r1->height > r2->top + r2->height) in v4l2_rect_enclosed()