mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
box: Implement the correct paint volume
The allocation of the ClutterBox is not enough to be used as the paint volume, because children might decide to paint outside that area. Instead, we should use the allocation if the Box has a background color and then do what Group does, and union all the paint volumes of the children. http://bugzilla.clutter-project.org/show_bug.cgi?id=2600
This commit is contained in:
parent
d1500c03c0
commit
49d38b1e21
@ -302,9 +302,40 @@ static gboolean
|
||||
clutter_box_real_get_paint_volume (ClutterActor *actor,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
return _clutter_actor_set_default_paint_volume (actor,
|
||||
CLUTTER_TYPE_BOX,
|
||||
volume);
|
||||
ClutterBoxPrivate *priv = CLUTTER_BOX (actor)->priv;
|
||||
gboolean retval = FALSE;
|
||||
GList *l;
|
||||
|
||||
/* if we have a background color, and an allocation, then we need to
|
||||
* set it as the base of our paint volume
|
||||
*/
|
||||
if (priv->color_set)
|
||||
retval = clutter_paint_volume_set_from_allocation (volume, actor);
|
||||
|
||||
/* bail out early if we don't have any child */
|
||||
if (priv->children == NULL)
|
||||
return retval;
|
||||
else
|
||||
retval = TRUE;
|
||||
|
||||
/* otherwise, union the paint volumes of our children, in case
|
||||
* any one of them decides to paint outside the parent's allocation
|
||||
*/
|
||||
for (l = priv->children; l != NULL; l = l->next)
|
||||
{
|
||||
ClutterActor *child = l->data;
|
||||
const ClutterPaintVolume *child_volume;
|
||||
|
||||
/* This gets the paint volume of the child transformed into the
|
||||
* group's coordinate space... */
|
||||
child_volume = clutter_actor_get_transformed_paint_volume (child, actor);
|
||||
if (!child_volume)
|
||||
return FALSE;
|
||||
|
||||
clutter_paint_volume_union (volume, child_volume);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user