mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
util/box: Add a intersect_2d helper
Fixes:3d38c9597f("zink: hook up KHR_partial_update") Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33855> (cherry picked from commit8cf921a742)
This commit is contained in:
parent
6b92f95f6e
commit
a8a5e94ddf
2 changed files with 26 additions and 1 deletions
|
|
@ -5124,7 +5124,7 @@
|
|||
"description": "util/box: Add a intersect_2d helper",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "3d38c9597ff3b687026fa4c664f8b4aa20b97f53",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -190,6 +190,31 @@ u_box_union_2d(struct pipe_box *dst,
|
|||
dst->y = y;
|
||||
}
|
||||
|
||||
/* Aliasing of @dst permitted. */
|
||||
static inline void
|
||||
u_box_intersect_2d(struct pipe_box *dst,
|
||||
const struct pipe_box *a, const struct pipe_box *b)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
x = MAX2(a->x, b->x);
|
||||
y = MAX2(a->y, b->y);
|
||||
|
||||
dst->width = MIN2(a->x + a->width, b->x + b->width) - x;
|
||||
dst->x = x;
|
||||
if (dst->width <= 0) {
|
||||
dst->x = 0;
|
||||
dst->width = 0;
|
||||
}
|
||||
|
||||
dst->height = MIN2(a->y + a->height, b->y + b->height) - y;
|
||||
dst->y = y;
|
||||
if (dst->height <= 0) {
|
||||
dst->y = 0;
|
||||
dst->height = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Aliasing of @dst permitted. */
|
||||
static inline void
|
||||
u_box_union_3d(struct pipe_box *dst,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue