From 2d895816be659a86d999748ecf631422b9e9176f Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Thu, 9 Sep 2010 17:53:29 +0100 Subject: [PATCH] paint_volume: Adds _clutter_paint_volume_set_from_volume This adds a way to initialize a paint volume from another source paint volume. This lets us for instance pass the contents of one paint volume back through the out param of a get_paint_volume implementation. --- clutter/clutter-paint-volume.c | 12 ++++++++++++ clutter/clutter-private.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/clutter/clutter-paint-volume.c b/clutter/clutter-paint-volume.c index c60baf0ca..8435da51e 100644 --- a/clutter/clutter-paint-volume.c +++ b/clutter/clutter-paint-volume.c @@ -150,6 +150,18 @@ clutter_paint_volume_copy (const ClutterPaintVolume *pv) return copy; } +void +_clutter_paint_volume_set_from_volume (ClutterPaintVolume *pv, + const ClutterPaintVolume *src) +{ + if (src->actor != pv->actor) + { + g_object_unref (pv->actor); + g_object_ref (src->actor); + } + memcpy (pv, src, sizeof (ClutterPaintVolume)); +} + /** * clutter_paint_volume_free: * @pv: a #ClutterPaintVolume diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h index 1064cecfc..1529bb1bf 100644 --- a/clutter/clutter-private.h +++ b/clutter/clutter-private.h @@ -510,6 +510,9 @@ void _clutter_paint_volume_init_static (ClutterActor *actor, 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);