[cairo-commit] goocanvas/src goocanvasitem.c,1.29,1.30
Damon Chaplin
commit at pdx.freedesktop.org
Mon Apr 16 07:10:54 PDT 2007
Committed by: damon
Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv23163/src
Modified Files:
goocanvasitem.c
Log Message:
2007-04-16 Damon Chaplin <damon at gnome.org>
* src/goocanvasitem.c (goo_canvas_item_animate_cb): check keep_source
before updating the item so we don't use the freed animation data.
Index: goocanvasitem.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvasitem.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- goocanvasitem.c 30 Mar 2007 11:40:28 -0000 1.29
+++ goocanvasitem.c 16 Apr 2007 14:10:44 -0000 1.30
@@ -1071,6 +1071,9 @@
static gboolean
goo_canvas_item_animate_cb (GooCanvasItemAnimation *anim)
{
+ GooCanvasItem *item = anim->item;
+ GooCanvasItemModel *model = anim->model;
+ GooCanvasAnimateType type = anim->type;
GooCanvasItemIface *iface;
GooCanvasItemModelIface *model_iface;
cairo_matrix_t new_matrix;
@@ -1080,21 +1083,21 @@
GDK_THREADS_ENTER ();
- if (anim->model)
- model_iface = GOO_CANVAS_ITEM_MODEL_GET_IFACE (anim->model);
+ if (model)
+ model_iface = GOO_CANVAS_ITEM_MODEL_GET_IFACE (model);
else
- iface = GOO_CANVAS_ITEM_GET_IFACE (anim->item);
+ iface = GOO_CANVAS_ITEM_GET_IFACE (item);
if (++anim->step > anim->total_steps)
{
- switch (anim->type)
+ switch (type)
{
case GOO_CANVAS_ANIMATE_RESET:
/* Reset the transform to the initial value. */
- if (anim->model)
- model_iface->set_transform (anim->model, &anim->start);
+ if (model)
+ model_iface->set_transform (model, &anim->start);
else
- iface->set_transform (anim->item, &anim->start);
+ iface->set_transform (item, &anim->start);
/* Fall through.. */
case GOO_CANVAS_ANIMATE_FREEZE:
@@ -1102,10 +1105,10 @@
anim->timeout_id = 0;
/* This will result in a call to goo_canvas_item_free_animation()
above. We've set the timeout_id to 0 so it isn't removed twice. */
- if (anim->model)
- g_object_set_data (G_OBJECT (anim->model), animation_key, NULL);
+ if (model)
+ g_object_set_data (G_OBJECT (model), animation_key, NULL);
else
- g_object_set_data (G_OBJECT (anim->item), animation_key, NULL);
+ g_object_set_data (G_OBJECT (item), animation_key, NULL);
break;
case GOO_CANVAS_ANIMATE_RESTART:
@@ -1119,34 +1122,36 @@
}
}
- step = anim->forward ? anim->step : anim->total_steps - anim->step;
-
- if (anim->absolute)
- {
- cairo_matrix_init_identity (&new_matrix);
- scale = anim->scale_start + anim->scale_step * step;
- cairo_matrix_translate (&new_matrix,
- anim->x_start + anim->x_step * step,
- anim->y_start + anim->y_step * step);
- cairo_matrix_scale (&new_matrix, scale, scale);
- cairo_matrix_rotate (&new_matrix,
- anim->radians_start + anim->radians_step * step);
- }
- else
+ if (keep_source)
{
- new_matrix = anim->start;
- scale = 1 + anim->scale_step * step;
- cairo_matrix_translate (&new_matrix, anim->x_step * step,
- anim->y_step * step);
- cairo_matrix_scale (&new_matrix, scale, scale);
- cairo_matrix_rotate (&new_matrix, anim->radians_step * step);
- }
+ step = anim->forward ? anim->step : anim->total_steps - anim->step;
- if (anim->model)
- model_iface->set_transform (anim->model, &new_matrix);
- else
- iface->set_transform (anim->item, &new_matrix);
+ if (anim->absolute)
+ {
+ cairo_matrix_init_identity (&new_matrix);
+ scale = anim->scale_start + anim->scale_step * step;
+ cairo_matrix_translate (&new_matrix,
+ anim->x_start + anim->x_step * step,
+ anim->y_start + anim->y_step * step);
+ cairo_matrix_scale (&new_matrix, scale, scale);
+ cairo_matrix_rotate (&new_matrix,
+ anim->radians_start + anim->radians_step * step);
+ }
+ else
+ {
+ new_matrix = anim->start;
+ scale = 1 + anim->scale_step * step;
+ cairo_matrix_translate (&new_matrix, anim->x_step * step,
+ anim->y_step * step);
+ cairo_matrix_scale (&new_matrix, scale, scale);
+ cairo_matrix_rotate (&new_matrix, anim->radians_step * step);
+ }
+ if (model)
+ model_iface->set_transform (model, &new_matrix);
+ else
+ iface->set_transform (item, &new_matrix);
+ }
GDK_THREADS_LEAVE ();
More information about the cairo-commit
mailing list