2 * SPDX-License-Identifier: GPL-2.0-or-later
10 typedef struct QemuRect
{
17 static inline void qemu_rect_init(QemuRect
*rect
,
19 uint16_t width
, uint16_t height
)
24 rect
->height
= height
;
27 static inline void qemu_rect_translate(QemuRect
*rect
,
28 int16_t dx
, int16_t dy
)
34 static inline bool qemu_rect_intersect(const QemuRect
*a
, const QemuRect
*b
,
37 int16_t x1
, x2
, y1
, y2
;
41 x2
= MIN(a
->x
+ a
->width
, b
->x
+ b
->width
);
42 y2
= MIN(a
->y
+ a
->height
, b
->y
+ b
->height
);
44 if (x1
>= x2
|| y1
>= y2
) {
46 qemu_rect_init(res
, 0, 0, 0, 0);
53 qemu_rect_init(res
, x1
, y1
, x2
- x1
, y2
- y1
);