From 7d8effd5e26495dc3e01ba741a0389364183fc5f Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Thu, 9 Sep 2010 18:51:17 +0100 Subject: [PATCH] paint_volume: add private api to change reference actor For Clone actors we will need a way to report the volume of the source actor as the volume of the clone actor. To make this work though we need to be able to replace the reference to the source actor with a reference to the clone actor instead. This adds a private _clutter_paint_volume_set_reference_actor function to do that. --- clutter/clutter-paint-volume.c | 15 ++++++++++++++ clutter/clutter-private.h | 36 ++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/clutter/clutter-paint-volume.c b/clutter/clutter-paint-volume.c index 8435da51e..969bef739 100644 --- a/clutter/clutter-paint-volume.c +++ b/clutter/clutter-paint-volume.c @@ -908,3 +908,18 @@ clutter_paint_volume_set_from_allocation (ClutterPaintVolume *pv, return _clutter_actor_set_default_paint_volume (actor, G_TYPE_INVALID, pv); } + +/* Currently paint volumes are defined relative to a given actor, but + * in some cases it is desireable to be able to change the actor that + * a volume relates too (For instance for ClutterClone actors where we + * need to masquarade the source actors volume as the volume for the + * clone). */ +void +_clutter_paint_volume_set_reference_actor (ClutterPaintVolume *pv, + ClutterActor *actor) +{ + g_return_if_fail (pv != NULL); + + g_object_unref (pv->actor); + pv->actor = g_object_ref (actor); +} diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h index 1529bb1bf..1186b848b 100644 --- a/clutter/clutter-private.h +++ b/clutter/clutter-private.h @@ -505,24 +505,26 @@ gpointer _clutter_event_get_platform_data (const ClutterEvent *event); #endif -void _clutter_paint_volume_init_static (ClutterActor *actor, - ClutterPaintVolume *pv); -ClutterPaintVolume *_clutter_paint_volume_new (ClutterActor *actor); -void _clutter_paint_volume_copy_static (const ClutterPaintVolume *src_pv, - ClutterPaintVolume *dst_pv); -void _clutter_paint_volume_set_from_volume (ClutterPaintVolume *pv, - const ClutterPaintVolume *src); +void _clutter_paint_volume_init_static (ClutterActor *actor, + ClutterPaintVolume *pv); +ClutterPaintVolume *_clutter_paint_volume_new (ClutterActor *actor); +void _clutter_paint_volume_copy_static (const ClutterPaintVolume *src_pv, + ClutterPaintVolume *dst_pv); +void _clutter_paint_volume_set_from_volume (ClutterPaintVolume *pv, + const ClutterPaintVolume *src); -void _clutter_paint_volume_complete (ClutterPaintVolume *pv); -void _clutter_paint_volume_transform (ClutterPaintVolume *pv, - const CoglMatrix *matrix); -void _clutter_paint_volume_project (ClutterPaintVolume *pv, - const CoglMatrix *modelview, - const CoglMatrix *projection, - const int *viewport); -void _clutter_paint_volume_get_bounding_box (ClutterPaintVolume *pv, - ClutterActorBox *box); -void _clutter_paint_volume_axis_align (ClutterPaintVolume *pv); +void _clutter_paint_volume_complete (ClutterPaintVolume *pv); +void _clutter_paint_volume_transform (ClutterPaintVolume *pv, + const CoglMatrix *matrix); +void _clutter_paint_volume_project (ClutterPaintVolume *pv, + const CoglMatrix *modelview, + const CoglMatrix *projection, + const int *viewport); +void _clutter_paint_volume_get_bounding_box (ClutterPaintVolume *pv, + ClutterActorBox *box); +void _clutter_paint_volume_axis_align (ClutterPaintVolume *pv); +void _clutter_paint_volume_set_reference_actor (ClutterPaintVolume *pv, + ClutterActor *actor);