[clutter-interval] Fix calculation of interval for unsigned types
The patch makes it cast to double before subtracting the original value from the target value. Otherwise if the target value is less than the original value then the subtraction will overflow and the factor will be multiplied by a very large number instead of the desired interval. The problem is demonstrable using the border-width property of ClutterRectangle.
This commit is contained in:
parent
140e4e1be2
commit
2bf815131a
@ -206,7 +206,7 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
|
||||
ia = g_value_get_uint (initial);
|
||||
ib = g_value_get_uint (final);
|
||||
|
||||
res = (factor * (ib - ia)) + ia;
|
||||
res = (factor * (ib - (gdouble) ia)) + ia;
|
||||
|
||||
g_value_set_uint (value, res);
|
||||
}
|
||||
@ -219,7 +219,7 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
|
||||
ia = g_value_get_uchar (initial);
|
||||
ib = g_value_get_uchar (final);
|
||||
|
||||
res = (factor * (ib - ia)) + ia;
|
||||
res = (factor * (ib - (gdouble) ia)) + ia;
|
||||
|
||||
g_value_set_uchar (value, res);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user