1
0
Fork 0

clutter/actor: Clean up real_get_paint_volume() a bit

We can get rid of an indentation level and the "ret" variable here and
instead simply early-return when we need to.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1492>
This commit is contained in:
Jonas Dreßler 2020-11-21 11:45:57 +01:00 committed by Marge Bot
parent 93ba039b90
commit 830561405c

View file

@ -5664,7 +5664,7 @@ clutter_actor_real_get_paint_volume (ClutterActor *self,
ClutterPaintVolume *volume) ClutterPaintVolume *volume)
{ {
ClutterActorPrivate *priv = self->priv; ClutterActorPrivate *priv = self->priv;
gboolean res = TRUE; ClutterActor *child;
/* this should be checked before we call this function, but it's a /* this should be checked before we call this function, but it's a
* good idea to be explicit when it costs us nothing * good idea to be explicit when it costs us nothing
@ -5698,19 +5698,11 @@ clutter_actor_real_get_paint_volume (ClutterActor *self,
* outside the clip region. * outside the clip region.
*/ */
if (priv->clip_to_allocation) if (priv->clip_to_allocation)
{ return TRUE;
/* the allocation has already been set, so we just flip the
* return value
*/
res = TRUE;
}
else
{
ClutterActor *child;
/* if we don't have children we just bail out here... */ /* if we don't have children we just bail out here... */
if (priv->n_children == 0) if (priv->n_children == 0)
return res; return TRUE;
/* ...but if we have children then we ask for their paint volume in /* ...but if we have children then we ask for their paint volume in
* our coordinates. if any of our children replies that it doesn't * our coordinates. if any of our children replies that it doesn't
@ -5735,17 +5727,12 @@ clutter_actor_real_get_paint_volume (ClutterActor *self,
child_volume = clutter_actor_get_transformed_paint_volume (child, self); child_volume = clutter_actor_get_transformed_paint_volume (child, self);
if (child_volume == NULL) if (child_volume == NULL)
{ return FALSE;
res = FALSE;
break;
}
clutter_paint_volume_union (volume, child_volume); clutter_paint_volume_union (volume, child_volume);
res = TRUE;
}
} }
return res; return TRUE;
} }
static gboolean static gboolean