mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 04:42:14 +00:00
geometry: Avoid sign issues when interpolating
Width and height in ClutterGeometry are unsigned, and this might lead to overflow and wrap around issues.
This commit is contained in:
parent
c3313726f0
commit
6c244c0549
@ -9244,12 +9244,16 @@ clutter_geometry_progress (const GValue *a,
|
|||||||
const ClutterGeometry *a_geom = g_value_get_boxed (a);
|
const ClutterGeometry *a_geom = g_value_get_boxed (a);
|
||||||
const ClutterGeometry *b_geom = g_value_get_boxed (b);
|
const ClutterGeometry *b_geom = g_value_get_boxed (b);
|
||||||
ClutterGeometry res = { 0, };
|
ClutterGeometry res = { 0, };
|
||||||
|
gint a_width = a_geom->width;
|
||||||
|
gint b_width = b_geom->width;
|
||||||
|
gint a_height = a_geom->height;
|
||||||
|
gint b_height = b_geom->height;
|
||||||
|
|
||||||
res.x = a_geom->x + (b_geom->x - a_geom->x) * progress;
|
res.x = a_geom->x + (b_geom->x - a_geom->x) * progress;
|
||||||
res.y = a_geom->y + (b_geom->y - a_geom->y) * progress;
|
res.y = a_geom->y + (b_geom->y - a_geom->y) * progress;
|
||||||
|
|
||||||
res.width = a_geom->width + (b_geom->width - a_geom->width) * progress;
|
res.width = a_width + (b_width - a_width) * progress;
|
||||||
res.height = a_geom->height + (b_geom->height - a_geom->height) * progress;
|
res.height = a_height + (b_height - a_height) * progress;
|
||||||
|
|
||||||
g_value_set_boxed (retval, &res);
|
g_value_set_boxed (retval, &res);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user