diff --git a/ChangeLog b/ChangeLog index d5e5a81b2..dea1cd2be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-11-20 Emmanuele Bassi + + * clutter/clutter-actor.c: + (clutter_actor_set_property): Add sanity checks for NULL + boxed values when setting the rotation center. + + * tests/interactive/test-animation.c: + (on_button_press): Add an example on how to use the rotation + properties to animate an actor. + 2008-11-18 Neil Roberts Fixed some trivial compiler warnings diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index f31a53ff6..81c4b750f 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -1681,12 +1681,13 @@ clutter_actor_set_property (GObject *object, ClutterVertex *center; center = g_value_get_boxed (value); - clutter_actor_set_rotation_internal (actor, - CLUTTER_X_AXIS, - priv->rxang, - 0, - center->y, - center->z); + if (center) + clutter_actor_set_rotation_internal (actor, + CLUTTER_X_AXIS, + priv->rxang, + 0, + center->y, + center->z); } break; case PROP_ROTATION_CENTER_Y: @@ -1694,12 +1695,13 @@ clutter_actor_set_property (GObject *object, ClutterVertex *center; center = g_value_get_boxed (value); - clutter_actor_set_rotation_internal (actor, - CLUTTER_Y_AXIS, - priv->ryang, - center->x, - 0, - center->z); + if (center) + clutter_actor_set_rotation_internal (actor, + CLUTTER_Y_AXIS, + priv->ryang, + center->x, + 0, + center->z); } break; case PROP_ROTATION_CENTER_Z: @@ -1707,12 +1709,13 @@ clutter_actor_set_property (GObject *object, ClutterVertex *center; center = g_value_get_boxed (value); - clutter_actor_set_rotation_internal (actor, - CLUTTER_Z_AXIS, - priv->rzang, - center->x, - center->y, - 0); + if (center) + clutter_actor_set_rotation_internal (actor, + CLUTTER_Z_AXIS, + priv->rzang, + center->x, + center->y, + 0); } break; case PROP_ANCHOR_X: diff --git a/tests/interactive/test-animation.c b/tests/interactive/test-animation.c index 0af76c8a0..000e02bd8 100644 --- a/tests/interactive/test-animation.c +++ b/tests/interactive/test-animation.c @@ -24,11 +24,16 @@ on_button_press (ClutterActor *actor, gint old_x, old_y, new_x, new_y; guint old_width, old_height, new_width, new_height; guint8 old_op, new_op; + gdouble new_angle; + ClutterVertex vertex = { 0, }; clutter_actor_get_position (actor, &old_x, &old_y); clutter_actor_get_size (actor, &old_width, &old_height); old_op = clutter_actor_get_opacity (actor); + /* determine the final state of the animation depending on + * the state of the actor + */ if (!is_expanded) { new_x = old_x - 100; @@ -36,6 +41,7 @@ on_button_press (ClutterActor *actor, new_width = old_width + 200; new_height = old_height + 200; new_op = 255; + new_angle = 360.0; } else { @@ -44,8 +50,12 @@ on_button_press (ClutterActor *actor, new_width = old_width - 200; new_height = old_height - 200; new_op = 128; + new_angle = 0.0; } + vertex.x = CLUTTER_UNITS_FROM_FLOAT ((float) new_width / 2); + vertex.y = CLUTTER_UNITS_FROM_FLOAT ((float) new_height / 2); + animation = clutter_actor_animate (actor, CLUTTER_EASE_IN, 2000, "x", new_x, @@ -53,6 +63,8 @@ on_button_press (ClutterActor *actor, "width", new_width, "height", new_height, "opacity", new_op, + "rotation-angle-z", new_angle, + "fixed::rotation-center-z", &vertex, "fixed::reactive", FALSE, NULL); g_signal_connect (animation,