.. | .. |
---|
24 | 24 | #ifndef DRM_RECT_H |
---|
25 | 25 | #define DRM_RECT_H |
---|
26 | 26 | |
---|
| 27 | +#include <linux/types.h> |
---|
| 28 | + |
---|
27 | 29 | /** |
---|
28 | 30 | * DOC: rect utils |
---|
29 | 31 | * |
---|
.. | .. |
---|
70 | 72 | (r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10 |
---|
71 | 73 | |
---|
72 | 74 | /** |
---|
| 75 | + * drm_rect_init - initialize the rectangle from x/y/w/h |
---|
| 76 | + * @r: rectangle |
---|
| 77 | + * @x: x coordinate |
---|
| 78 | + * @y: y coordinate |
---|
| 79 | + * @width: width |
---|
| 80 | + * @height: height |
---|
| 81 | + */ |
---|
| 82 | +static inline void drm_rect_init(struct drm_rect *r, int x, int y, |
---|
| 83 | + int width, int height) |
---|
| 84 | +{ |
---|
| 85 | + r->x1 = x; |
---|
| 86 | + r->y1 = y; |
---|
| 87 | + r->x2 = x + width; |
---|
| 88 | + r->y2 = y + height; |
---|
| 89 | +} |
---|
| 90 | + |
---|
| 91 | +/** |
---|
73 | 92 | * drm_rect_adjust_size - adjust the size of the rectangle |
---|
74 | 93 | * @r: rectangle to be adjusted |
---|
75 | 94 | * @dw: horizontal adjustment |
---|
.. | .. |
---|
104 | 123 | r->y1 += dy; |
---|
105 | 124 | r->x2 += dx; |
---|
106 | 125 | r->y2 += dy; |
---|
| 126 | +} |
---|
| 127 | + |
---|
| 128 | +/** |
---|
| 129 | + * drm_rect_translate_to - translate the rectangle to an absolute position |
---|
| 130 | + * @r: rectangle to be tranlated |
---|
| 131 | + * @x: horizontal position |
---|
| 132 | + * @y: vertical position |
---|
| 133 | + * |
---|
| 134 | + * Move rectangle @r to @x in the horizontal direction, |
---|
| 135 | + * and to @y in the vertical direction. |
---|
| 136 | + */ |
---|
| 137 | +static inline void drm_rect_translate_to(struct drm_rect *r, int x, int y) |
---|
| 138 | +{ |
---|
| 139 | + drm_rect_translate(r, x - r->x1, y - r->y1); |
---|
107 | 140 | } |
---|
108 | 141 | |
---|
109 | 142 | /** |
---|
.. | .. |
---|
147 | 180 | } |
---|
148 | 181 | |
---|
149 | 182 | /** |
---|
150 | | - * drm_rect_visible - determine if the the rectangle is visible |
---|
| 183 | + * drm_rect_visible - determine if the rectangle is visible |
---|
151 | 184 | * @r: rectangle whose visibility is returned |
---|
152 | 185 | * |
---|
153 | 186 | * RETURNS: |
---|
.. | .. |
---|
182 | 215 | int drm_rect_calc_vscale(const struct drm_rect *src, |
---|
183 | 216 | const struct drm_rect *dst, |
---|
184 | 217 | int min_vscale, int max_vscale); |
---|
185 | | -int drm_rect_calc_hscale_relaxed(struct drm_rect *src, |
---|
186 | | - struct drm_rect *dst, |
---|
187 | | - int min_hscale, int max_hscale); |
---|
188 | | -int drm_rect_calc_vscale_relaxed(struct drm_rect *src, |
---|
189 | | - struct drm_rect *dst, |
---|
190 | | - int min_vscale, int max_vscale); |
---|
191 | 218 | void drm_rect_debug_print(const char *prefix, |
---|
192 | 219 | const struct drm_rect *r, bool fixed_point); |
---|
193 | 220 | void drm_rect_rotate(struct drm_rect *r, |
---|