mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 05:20:17 +00:00
Add gsk_rect_normalize
This is an inline version of graphene_rect_normalize_in_place.
This commit is contained in:
parent
fd4f22bba5
commit
230ee92857
@ -159,3 +159,23 @@ gsk_rect_scale (const graphene_rect_t *r,
|
|||||||
res->size.width = r->size.width * sx;
|
res->size.width = r->size.width * sx;
|
||||||
res->size.height = r->size.height * sy;
|
res->size.height = r->size.height * sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
gsk_rect_normalize (graphene_rect_t *r)
|
||||||
|
{
|
||||||
|
if (r->size.width < 0.f)
|
||||||
|
{
|
||||||
|
float size = fabsf (r->size.width);
|
||||||
|
|
||||||
|
r->origin.x -= size;
|
||||||
|
r->size.width = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r->size.height < 0.f)
|
||||||
|
{
|
||||||
|
float size = fabsf (r->size.height);
|
||||||
|
|
||||||
|
r->origin.y -= size;
|
||||||
|
r->size.height = size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user