From 867db93043dd3c93d8ccb6cb197d4a3687d3a5e5 Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Sat, 18 Sep 2021 23:10:21 +0200 Subject: [PATCH] clutter/text: Invalidate actor paint volume when it has changed ClutterText implements its own get_paint_volume() with its own cache, but was not invalidating the actor paint volume when when it has changed. This sometimes could result in labels, especially quickly changing ones, using the old paint volume which either would cut off the label or leave parts of the old label on screen. Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1943 Part-of: --- clutter/clutter/clutter-text.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c index 08d17f6ce..fe28a9730 100644 --- a/clutter/clutter/clutter-text.c +++ b/clutter/clutter/clutter-text.c @@ -440,7 +440,7 @@ G_DEFINE_TYPE_WITH_CODE (ClutterText, clutter_animatable_iface_init)); static inline void -clutter_text_dirty_paint_volume (ClutterText *text) +clutter_text_free_paint_volume (ClutterText *text) { ClutterTextPrivate *priv = text->priv; @@ -451,6 +451,18 @@ clutter_text_dirty_paint_volume (ClutterText *text) } } +static inline void +clutter_text_dirty_paint_volume (ClutterText *text) +{ + ClutterTextPrivate *priv = text->priv; + + if (priv->paint_volume_valid) + { + clutter_text_free_paint_volume (text); + clutter_actor_invalidate_paint_volume (CLUTTER_ACTOR (text)); + } +} + static inline void clutter_text_queue_redraw (ClutterActor *self) { @@ -1785,7 +1797,7 @@ clutter_text_finalize (GObject *gobject) if (priv->preedit_attrs) pango_attr_list_unref (priv->preedit_attrs); - clutter_text_dirty_paint_volume (self); + clutter_text_free_paint_volume (self); clutter_text_set_buffer (self, NULL); g_free (priv->font_name);