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>
This commit is contained in:
Sebastian Keller 2021-09-18 23:10:21 +02:00 committed by Marge Bot
parent a0a612f18f
commit 867db93043

View File

@ -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);