2 * SPDX-License-Identifier: GPL-2.0-or-later
8 typedef struct QemuRect
{
15 static inline void qemu_rect_init(QemuRect
*rect
,
17 uint16_t width
, uint16_t height
)
22 rect
->height
= height
;
25 static inline void qemu_rect_translate(QemuRect
*rect
,
26 int16_t dx
, int16_t dy
)
32 static inline bool qemu_rect_intersect(const QemuRect
*a
, const QemuRect
*b
,
35 int16_t x1
, x2
, y1
, y2
;
39 x2
= MIN(a
->x
+ a
->width
, b
->x
+ b
->width
);
40 y2
= MIN(a
->y
+ a
->height
, b
->y
+ b
->height
);
42 if (x1
>= x2
|| y1
>= y2
) {
44 qemu_rect_init(res
, 0, 0, 0, 0);
51 qemu_rect_init(res
, x1
, y1
, x2
- x1
, y2
- y1
);