Add a note on the paint volume origin

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.
This commit is contained in:
Emmanuele Bassi 2012-02-13 18:19:48 +00:00
parent 8512dd2336
commit bbb7da03ac
3 changed files with 14 additions and 4 deletions

View 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

View 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:
*

View 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.
*