mirror of
https://github.com/brl/mutter.git
synced 2025-04-13 05:39:38 +00:00
clutter/actor: Handle clips correctly when building paint volume
clutter_actor_paint() implements a clear preference for custom clips over clip_to_allocation: If a custom clip is set, clip_to_allocation is ignored. Since the paint volume reflects what Clutter is going to paint, we should handle it the same when putting together our paint volume: So first handle custom clips, and if one is set, use that. Then handle clip_to_allocation, and if that's set, use that. And finally, if both aren't set, union our allocation with the children paint volumes to get the building volume. clutter_actor_paint() also doesn't check whether the custom clip is empty: If that's the case, it will simply not paint anything. Given that that's allowed by clutter_actor_paint(), the paint volume should also follow here and return an empty paint volume in case the custom clip is empty. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1592>
This commit is contained in:
parent
44563d2932
commit
b5a7fe4b23
@ -5701,6 +5701,21 @@ clutter_actor_update_default_paint_volume (ClutterActor *self,
|
|||||||
if (priv->needs_allocation)
|
if (priv->needs_allocation)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (priv->has_clip)
|
||||||
|
{
|
||||||
|
graphene_point3d_t origin;
|
||||||
|
|
||||||
|
origin.x = priv->clip.origin.x;
|
||||||
|
origin.y = priv->clip.origin.y;
|
||||||
|
origin.z = 0;
|
||||||
|
|
||||||
|
clutter_paint_volume_set_origin (volume, &origin);
|
||||||
|
clutter_paint_volume_set_width (volume, priv->clip.size.width);
|
||||||
|
clutter_paint_volume_set_height (volume, priv->clip.size.height);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* we start from the allocation */
|
/* we start from the allocation */
|
||||||
clutter_paint_volume_set_width (volume,
|
clutter_paint_volume_set_width (volume,
|
||||||
priv->allocation.x2 - priv->allocation.x1);
|
priv->allocation.x2 - priv->allocation.x1);
|
||||||
@ -5722,23 +5737,6 @@ clutter_actor_update_default_paint_volume (ClutterActor *self,
|
|||||||
{
|
{
|
||||||
ClutterActor *child;
|
ClutterActor *child;
|
||||||
|
|
||||||
if (priv->has_clip &&
|
|
||||||
priv->clip.size.width >= 0 &&
|
|
||||||
priv->clip.size.height >= 0)
|
|
||||||
{
|
|
||||||
graphene_point3d_t origin;
|
|
||||||
|
|
||||||
origin.x = priv->clip.origin.x;
|
|
||||||
origin.y = priv->clip.origin.y;
|
|
||||||
origin.z = 0;
|
|
||||||
|
|
||||||
clutter_paint_volume_set_origin (volume, &origin);
|
|
||||||
clutter_paint_volume_set_width (volume, priv->clip.size.width);
|
|
||||||
clutter_paint_volume_set_height (volume, priv->clip.size.height);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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 res;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user