[mutter] clutter/actor: Handle clips correctly when building paint volume
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/actor: Handle clips correctly when building paint volume
- Date: Mon, 23 Nov 2020 14:18:14 +0000 (UTC)
commit b5a7fe4b233ca80c998cb1f0a27fed495e1d13d1
Author: Jonas Dreßler <verdre v0yd nl>
Date: Sat Nov 21 11:26:42 2020 +0100
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>
clutter/clutter/clutter-actor.c | 32 +++++++++++++++-----------------
1 file changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 9ba0050a87..cabd95f8f3 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -5701,6 +5701,21 @@ clutter_actor_update_default_paint_volume (ClutterActor *self,
if (priv->needs_allocation)
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 */
clutter_paint_volume_set_width (volume,
priv->allocation.x2 - priv->allocation.x1);
@@ -5722,23 +5737,6 @@ clutter_actor_update_default_paint_volume (ClutterActor *self,
{
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 (priv->n_children == 0)
return res;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]