[mutter] clutter/text: Invalidate actor paint volume when it has changed



commit 867db93043dd3c93d8ccb6cb197d4a3687d3a5e5
Author: Sebastian Keller <skeller gnome org>
Date:   Sat Sep 18 23:10:21 2021 +0200

    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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2006>

 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 08d17f6ce8..fe28a9730e 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]