60#define DRM_RECT_INIT(x, y, w, h) ((struct drm_rect){ \
69#define DRM_RECT_FMT "%dx%d%+d%+d"
74#define DRM_RECT_ARG(r) drm_rect_width(r), drm_rect_height(r), (r)->x1, (r)->y1
79#define DRM_RECT_FP_FMT "%d.%06ux%d.%06u%+d.%06u%+d.%06u"
87#define DRM_RECT_FP_ARG(r) \
88 drm_rect_width(r) >> 16, ((drm_rect_width(r) & 0xffff) * 15625) >> 10, \
89 drm_rect_height(r) >> 16, ((drm_rect_height(r) & 0xffff) * 15625) >> 10, \
90 (r)->x1 >> 16, (((r)->x1 & 0xffff) * 15625) >> 10, \
91 (r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10
101static inline void drm_rect_init(
struct drm_rect *r,
int x,
int y,
102 int width,
int height)
122static inline void drm_rect_adjust_size(
struct drm_rect *r,
int dw,
int dh)
126 r->
x2 += (dw + 1) >> 1;
127 r->
y2 += (dh + 1) >> 1;
139static inline void drm_rect_translate(
struct drm_rect *r,
int dx,
int dy)
156static inline void drm_rect_translate_to(
struct drm_rect *r,
int x,
int y)
158 drm_rect_translate(r, x - r->
x1, y - r->
y1);
169static inline void drm_rect_downscale(
struct drm_rect *r,
int horz,
int vert)
184static inline int drm_rect_width(
const struct drm_rect *r)
186 return r->
x2 - r->
x1;
196static inline int drm_rect_height(
const struct drm_rect *r)
198 return r->
y2 - r->
y1;
208static inline bool drm_rect_visible(
const struct drm_rect *r)
210 return drm_rect_width(r) > 0 && drm_rect_height(r) > 0;
221static inline bool drm_rect_equals(
const struct drm_rect *r1,
224 return r1->
x1 == r2->
x1 && r1->
x2 == r2->
x2 &&
225 r1->
y1 == r2->
y1 && r1->
y2 == r2->
y2;
233static inline void drm_rect_fp_to_int(
struct drm_rect *dst,
236 drm_rect_init(dst, src->
x1 >> 16, src->
y1 >> 16,
237 drm_rect_width(src) >> 16,
238 drm_rect_height(src) >> 16);
249static inline bool drm_rect_overlap(
const struct drm_rect *
a,
252 return (
a->x2 >
b->x1 &&
b->x2 >
a->x1 &&
253 a->y2 >
b->y1 &&
b->y2 >
a->y1);
261 int min_hscale,
int max_hscale);
264 int min_vscale,
int max_vscale);
266 const struct drm_rect *r,
bool fixed_point);
268 int width,
int height,
269 unsigned int rotation);
271 int width,
int height,
272 unsigned int rotation);
size_t a
Definition main.cpp:156
size_t b
Definition main.cpp:156
void drm_rect_rotate_inv(struct drm_rect *r, int width, int height, unsigned int rotation)
void drm_rect_debug_print(const char *prefix, const struct drm_rect *r, bool fixed_point)
int drm_rect_calc_hscale(const struct drm_rect *src, const struct drm_rect *dst, int min_hscale, int max_hscale)
bool drm_rect_intersect(struct drm_rect *r, const struct drm_rect *clip)
bool drm_rect_clip_scaled(struct drm_rect *src, struct drm_rect *dst, const struct drm_rect *clip)
void drm_rect_rotate(struct drm_rect *r, int width, int height, unsigned int rotation)
int drm_rect_calc_vscale(const struct drm_rect *src, const struct drm_rect *dst, int min_vscale, int max_vscale)
i32 clip(i32 x, i32 y, i32 z)
int y
Definition layout.c:118
int x
Definition layout.c:118
int y2
Definition drm_rect.h:47
int x1
Definition drm_rect.h:47
int x2
Definition drm_rect.h:47
int y1
Definition drm_rect.h:47