Add gsk_bounding_box_get_corner

This will be used in the following commits.
This commit is contained in:
Matthias Clasen 2023-09-16 21:56:05 -04:00
parent 7cd97192e5
commit a6d2d983b8

View File

@ -112,4 +112,32 @@ gsk_bounding_box_union (const GskBoundingBox *a,
gsk_bounding_box_init (res, &min, &max);
}
G_END_DECLS
static inline void
gsk_bounding_box_get_corner (const GskBoundingBox *b,
GskCorner c,
graphene_point_t *p)
{
switch (c)
{
case GSK_CORNER_TOP_LEFT:
*p = b->min;
break;
case GSK_CORNER_TOP_RIGHT:
p->x = b->max.x;
p->y = b->min.y;
break;
case GSK_CORNER_BOTTOM_RIGHT:
*p = b->max;
break;
case GSK_CORNER_BOTTOM_LEFT:
p->x = b->min.x;
p->y = b->max.y;
break;
default:
g_assert_not_reached ();
}
}