Add a note on the paint volume origin
authorEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 13 Feb 2012 18:19:48 +0000 (18:19 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 13 Feb 2012 18:21:11 +0000 (18:21 +0000)
This should avoid trying to fix the origin of a paint volume set from
the allocation's origin, and thus breaking everything.

A PaintVolume for an actor is defined to be relative to the actor's
modelview unless specifically modified by internal functions; the origin
of an actor's allocation is, on the other hand, parent-relative.

clutter/clutter-actor.c
clutter/clutter-paint-volume.c
clutter/clutter-types.h

index 61ec219..3bb8b96 100644 (file)
@@ -4692,7 +4692,10 @@ clutter_actor_real_get_paint_volume (ClutterActor       *self,
   res = FALSE;
 
   /* we start from the allocation */
-  clutter_paint_volume_set_from_allocation (volume, self);
+  clutter_paint_volume_set_width (volume,
+                                  priv->allocation.x2 - priv->allocation.x1);
+  clutter_paint_volume_set_height (volume,
+                                   priv->allocation.y2 - priv->allocation.y1);
 
   /* if the actor has a clip set then we have a pretty definite
    * size for the paint volume: the actor cannot possibly paint
index 5b54274..419b281 100644 (file)
@@ -970,6 +970,10 @@ _clutter_actor_set_default_paint_volume (ClutterActor       *self,
 
   clutter_actor_get_allocation_box (self, &box);
 
+  /* we only set the width and height, as the paint volume is defined
+   * to be relative to the actor's modelview, which means that the
+   * allocation's origin has already been applied
+   */
   clutter_paint_volume_set_width (volume, box.x2 - box.x1);
   clutter_paint_volume_set_height (volume, box.y2 - box.y1);
 
@@ -984,8 +988,8 @@ _clutter_actor_set_default_paint_volume (ClutterActor       *self,
  * Sets the #ClutterPaintVolume from the allocation of @actor.
  *
  * This function should be used when overriding the
- * <function>get_paint_volume()</function> by #ClutterActor sub-classes that do
- * not paint outside their allocation.
+ * #ClutterActorClass.get_paint_volume() by #ClutterActor sub-classes
+ * that do not paint outside their allocation.
  *
  * A typical example is:
  *
index 2136874..ecd0d16 100644 (file)
@@ -112,9 +112,12 @@ typedef union _ClutterEvent             ClutterEvent;
  * whose members cannot be directly accessed.
  *
  * A <structname>ClutterPaintVolume</structname> represents an
- * a bounding volume whos internal representation isn't defined but
+ * a bounding volume whose internal representation isn't defined but
  * can be set and queried in terms of an axis aligned bounding box.
  *
+ * A <structname>ClutterPaintVolume</structname> for a #ClutterActor
+ * is defined to be relative from the current actor modelview matrix.
+ *
  * Other internal representation and methods for describing the
  * bounding volume may be added in the future.
  *