gsk: Inline some more rect functions

When we use graphene_rect_scale, the rect is always normalized,
so we can avoid some overhead here.
This commit is contained in:
Matthias Clasen
2024-01-20 11:00:33 -05:00
parent 25ea6beb39
commit 9ebaafa2af

View File

@@ -132,3 +132,20 @@ gsk_rect_round_larger (graphene_rect_t *rect)
ceil (rect->origin.y + rect->size.height) - y);
}
static inline void
gsk_rect_scale (const graphene_rect_t *r,
float sx,
float sy,
graphene_rect_t *res)
{
if (G_UNLIKELY (sx < 0 || sy < 0))
{
graphene_rect_scale (r, sx, sy, res);
return;
}
res->origin.x = r->origin.x * sx;
res->origin.y = r->origin.y * sy;
res->size.width = r->size.width * sx;
res->size.height = r->size.height * sy;
}