actor: Be more conservative with the default paint volume

Check the allocation, when one is being used to initialize the paint
volume.
This commit is contained in:
Emmanuele Bassi 2012-01-18 16:05:12 +00:00
parent eafb0ee734
commit 70679dc68c

View File

@ -4365,6 +4365,8 @@ clutter_actor_real_get_paint_volume (ClutterActor *self,
ClutterActor *child; ClutterActor *child;
gboolean res; gboolean res;
clutter_paint_volume_set_from_allocation (volume, self);
/* this is the default return value: we cannot know if a class /* this is the default return value: we cannot know if a class
* is going to paint outside its allocation, so we take the * is going to paint outside its allocation, so we take the
* conservative approach. * conservative approach.
@ -4377,11 +4379,20 @@ clutter_actor_real_get_paint_volume (ClutterActor *self,
*/ */
if (priv->clip_to_allocation) if (priv->clip_to_allocation)
{ {
clutter_paint_volume_set_from_allocation (volume, self); float w, h;
res = TRUE; w = h = 0.f;
clutter_actor_box_get_size (&priv->allocation, &w, &h);
if (w >= 0 && h >= 0)
{
clutter_paint_volume_set_from_allocation (volume, self);
res = TRUE;
}
} }
else if (priv->has_clip) else if (priv->has_clip &&
priv->clip.width >= 0 &&
priv->clip.height >= 0)
{ {
ClutterVertex origin; ClutterVertex origin;