}
static gboolean
-clutter_actor_real_get_paint_volume (ClutterActor *self,
- ClutterPaintVolume *volume)
+clutter_actor_update_default_paint_volume (ClutterActor *self,
+ ClutterPaintVolume *volume)
{
ClutterActorPrivate *priv = self->priv;
- ClutterActor *child;
- ClutterActorClass *klass;
- gboolean res;
-
- klass = CLUTTER_ACTOR_GET_CLASS (self);
-
- /* XXX - this thoroughly sucks, but we don't want to penalize users
- * who use ClutterActor as a "new ClutterGroup" by forcing a full-stage
- * redraw. This should go away in 2.0.
- */
- if (klass->paint == clutter_actor_real_paint &&
- klass->get_paint_volume == clutter_actor_real_get_paint_volume)
- {
- res = TRUE;
- }
- else
- {
- /* this is the default return value: we cannot know if a class
- * is going to paint outside its allocation, so we take the
- * conservative approach.
- */
- res = FALSE;
- }
+ gboolean res = FALSE;
/* we start from the allocation */
clutter_paint_volume_set_width (volume,
}
else
{
+ ClutterActor *child;
+
if (priv->has_clip &&
priv->clip.width >= 0 &&
priv->clip.height >= 0)
}
return res;
+
+}
+
+static gboolean
+clutter_actor_real_get_paint_volume (ClutterActor *self,
+ ClutterPaintVolume *volume)
+{
+ ClutterActorClass *klass;
+ gboolean res;
+
+ klass = CLUTTER_ACTOR_GET_CLASS (self);
+
+ /* XXX - this thoroughly sucks, but we don't want to penalize users
+ * who use ClutterActor as a "new ClutterGroup" by forcing a full-stage
+ * redraw. This should go away in 2.0.
+ */
+ if (klass->paint == clutter_actor_real_paint &&
+ klass->get_paint_volume == clutter_actor_real_get_paint_volume)
+ {
+ res = TRUE;
+ }
+ else
+ {
+ /* this is the default return value: we cannot know if a class
+ * is going to paint outside its allocation, so we take the
+ * conservative approach.
+ */
+ res = FALSE;
+ }
+
+ if (clutter_actor_update_default_paint_volume (self, volume))
+ return res;
+
+ return FALSE;
+}
+
+/**
+ * clutter_actor_get_default_paint_volume:
+ * @self: a #ClutterActor
+ *
+ * Retrieves the default paint volume for @self.
+ *
+ * This function provides the same #ClutterPaintVolume that would be
+ * computed by the default implementation inside #ClutterActor of the
+ * #ClutterActorClass.get_paint_volume() virtual function.
+ *
+ * This function should only be used by #ClutterActor subclasses that
+ * cannot chain up to the parent implementation when computing their
+ * paint volume.
+ *
+ * Return value: (transfer none): a pointer to the default
+ * #ClutterPaintVolume, relative to the #ClutterActor, or %NULL if
+ * the actor could not compute a valid paint volume. The returned value
+ * is not guaranteed to be stable across multiple frames, so if you
+ * want to retain it, you will need to copy it using
+ * clutter_paint_volume_copy().
+ *
+ * Since: 1.10
+ */
+const ClutterPaintVolume *
+clutter_actor_get_default_paint_volume (ClutterActor *self)
+{
+ ClutterPaintVolume volume;
+ ClutterPaintVolume *res;
+
+ g_return_val_if_fail (CLUTTER_IS_ACTOR (self), NULL);
+
+ res = NULL;
+ _clutter_paint_volume_init_static (&volume, self);
+ if (clutter_actor_update_default_paint_volume (self, &volume))
+ {
+ ClutterActor *stage = _clutter_actor_get_stage_internal (self);
+
+ if (stage != NULL)
+ {
+ res = _clutter_stage_paint_volume_stack_allocate (CLUTTER_STAGE (stage));
+ _clutter_paint_volume_copy_static (&volume, res);
+ }
+ }
+
+ clutter_paint_volume_free (&volume);
+
+ return res;
}
static gboolean
* ensure their volume has a depth of 0. (This will be true so long as
* you don't call clutter_paint_volume_set_depth().)</note>
*
- * Return value: (transfer none): a pointer to a #ClutterPaintVolume
- * or %NULL if no volume could be determined.
+ * Return value: (transfer none): a pointer to a #ClutterPaintVolume,
+ * or %NULL if no volume could be determined. The returned pointer
+ * is not guaranteed to be valid across multiple frames; if you want
+ * to keep it, you will need to copy it using clutter_paint_volume_copy().
*
* Since: 1.6
*/
* transformed paint volume of all of its children and union them
* together using clutter_paint_volume_union().
*
- * Return value: (transfer none): a pointer to a #ClutterPaintVolume
- * or %NULL if no volume could be determined.
+ * Return value: (transfer none): a pointer to a #ClutterPaintVolume,
+ * or %NULL if no volume could be determined. The returned pointer is
+ * not guaranteed to be valid across multiple frames; if you wish to
+ * keep it, you will have to copy it using clutter_paint_volume_copy().
*
* Since: 1.6
*/