mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
[animation] Interval::compute_value should return a boolean
If the computation of the interval value depending on the progress was not successful, ClutterInterval::compute_value() should return this information to the caller.
This commit is contained in:
parent
854cf5d499
commit
ff48c3ef7c
@ -683,9 +683,9 @@ on_alpha_notify (GObject *gobject,
|
|||||||
g_value_init (&value, clutter_interval_get_value_type (interval));
|
g_value_init (&value, clutter_interval_get_value_type (interval));
|
||||||
|
|
||||||
factor = (gdouble) alpha_value / CLUTTER_ALPHA_MAX_ALPHA;
|
factor = (gdouble) alpha_value / CLUTTER_ALPHA_MAX_ALPHA;
|
||||||
clutter_interval_compute_value (interval, factor, &value);
|
|
||||||
|
|
||||||
g_object_set_property (G_OBJECT (priv->actor), p_name, &value);
|
if (clutter_interval_compute_value (interval, factor, &value))
|
||||||
|
g_object_set_property (G_OBJECT (priv->actor), p_name, &value);
|
||||||
|
|
||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
}
|
}
|
||||||
|
@ -172,13 +172,14 @@ clutter_interval_real_validate (ClutterInterval *interval,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
clutter_interval_real_compute_value (ClutterInterval *interval,
|
clutter_interval_real_compute_value (ClutterInterval *interval,
|
||||||
gdouble factor,
|
gdouble factor,
|
||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
GValue *initial, *final;
|
GValue *initial, *final;
|
||||||
GType value_type;
|
GType value_type;
|
||||||
|
gboolean retval = FALSE;
|
||||||
|
|
||||||
initial = clutter_interval_peek_initial_value (interval);
|
initial = clutter_interval_peek_initial_value (interval);
|
||||||
final = clutter_interval_peek_final_value (interval);
|
final = clutter_interval_peek_final_value (interval);
|
||||||
@ -197,6 +198,8 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
|
|||||||
res = (factor * (ib - ia)) + ia;
|
res = (factor * (ib - ia)) + ia;
|
||||||
|
|
||||||
g_value_set_int (value, res);
|
g_value_set_int (value, res);
|
||||||
|
|
||||||
|
retval = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -210,6 +213,8 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
|
|||||||
res = (factor * (ib - (gdouble) ia)) + ia;
|
res = (factor * (ib - (gdouble) ia)) + ia;
|
||||||
|
|
||||||
g_value_set_uint (value, res);
|
g_value_set_uint (value, res);
|
||||||
|
|
||||||
|
retval = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -223,6 +228,8 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
|
|||||||
res = (factor * (ib - (gdouble) ia)) + ia;
|
res = (factor * (ib - (gdouble) ia)) + ia;
|
||||||
|
|
||||||
g_value_set_uchar (value, res);
|
g_value_set_uchar (value, res);
|
||||||
|
|
||||||
|
retval = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -240,6 +247,8 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
|
|||||||
g_value_set_double (value, res);
|
g_value_set_double (value, res);
|
||||||
else
|
else
|
||||||
g_value_set_float (value, res);
|
g_value_set_float (value, res);
|
||||||
|
|
||||||
|
retval = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -248,6 +257,8 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
|
|||||||
g_value_set_boolean (value, TRUE);
|
g_value_set_boolean (value, TRUE);
|
||||||
else
|
else
|
||||||
g_value_set_boolean (value, FALSE);
|
g_value_set_boolean (value, FALSE);
|
||||||
|
|
||||||
|
retval = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case G_TYPE_BOXED:
|
case G_TYPE_BOXED:
|
||||||
@ -265,12 +276,16 @@ clutter_interval_real_compute_value (ClutterInterval *interval,
|
|||||||
res.alpha = (factor * (ib->alpha - (gdouble) ia->alpha)) + ia->alpha;
|
res.alpha = (factor * (ib->alpha - (gdouble) ia->alpha)) + ia->alpha;
|
||||||
|
|
||||||
clutter_value_set_color (value, &res);
|
clutter_value_set_color (value, &res);
|
||||||
|
|
||||||
|
retval = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -837,19 +852,21 @@ clutter_interval_validate (ClutterInterval *interval,
|
|||||||
* Computes the value between the @interval boundaries given the
|
* Computes the value between the @interval boundaries given the
|
||||||
* progress @factor and puts it into @value.
|
* progress @factor and puts it into @value.
|
||||||
*
|
*
|
||||||
|
* Return value: %TRUE if the operation was successful
|
||||||
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void
|
gboolean
|
||||||
clutter_interval_compute_value (ClutterInterval *interval,
|
clutter_interval_compute_value (ClutterInterval *interval,
|
||||||
gdouble factor,
|
gdouble factor,
|
||||||
GValue *value)
|
GValue *value)
|
||||||
{
|
{
|
||||||
g_return_if_fail (CLUTTER_IS_INTERVAL (interval));
|
g_return_val_if_fail (CLUTTER_IS_INTERVAL (interval), FALSE);
|
||||||
g_return_if_fail (value != NULL);
|
g_return_val_if_fail (value != NULL, FALSE);
|
||||||
|
|
||||||
factor = CLAMP (factor, 0.0, 1.0);
|
factor = CLAMP (factor, 0.0, 1.0);
|
||||||
|
|
||||||
CLUTTER_INTERVAL_GET_CLASS (interval)->compute_value (interval,
|
return CLUTTER_INTERVAL_GET_CLASS (interval)->compute_value (interval,
|
||||||
factor,
|
factor,
|
||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ struct _ClutterIntervalClass
|
|||||||
/*< public >*/
|
/*< public >*/
|
||||||
gboolean (* validate) (ClutterInterval *interval,
|
gboolean (* validate) (ClutterInterval *interval,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
void (* compute_value) (ClutterInterval *interval,
|
gboolean (* compute_value) (ClutterInterval *interval,
|
||||||
gdouble factor,
|
gdouble factor,
|
||||||
GValue *value);
|
GValue *value);
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ void clutter_interval_get_interval (ClutterInterval *interval,
|
|||||||
|
|
||||||
gboolean clutter_interval_validate (ClutterInterval *interval,
|
gboolean clutter_interval_validate (ClutterInterval *interval,
|
||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
void clutter_interval_compute_value (ClutterInterval *interval,
|
gboolean clutter_interval_compute_value (ClutterInterval *interval,
|
||||||
gdouble factor,
|
gdouble factor,
|
||||||
GValue *value);
|
GValue *value);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user