[mutter] clutter/actor: Add API to invalidate cached paint volumes



commit 7aa147829de1dddcdacf416da358c7a4a9a94c29
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Sat Oct 24 13:20:26 2020 +0200

    clutter/actor: Add API to invalidate cached paint volumes
    
    ClutterActors can override the get_paint_volume() vfunc in case they
    draw outside the allocation. That's used by a bunch of actors, for
    example ClutterText or StViewport in gnome-shell.
    
    In case of StViewport, the paint volume returned depends on the value of
    the StAdjustment, which means when we start to cache paint volumes more
    agressively in ClutterActor, we'll need to add API that allows
    StViewport to invalidate the paint volume. So introduce
    clutter_actor_invalidate_paint_volume() to invalidate the cached paint
    volume.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1773>

 clutter/clutter/clutter-actor.c | 17 +++++++++++++++++
 clutter/clutter/clutter-actor.h |  3 +++
 2 files changed, 20 insertions(+)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 0a0884415d..7aac4ab847 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -19533,6 +19533,23 @@ clutter_actor_invalidate_transform (ClutterActor *self)
   transform_changed (self);
 }
 
+/**
+ * clutter_actor_invalidate_paint_volume:
+ * @self: A #ClutterActor
+ *
+ * Invalidates the cached paint volume of @self. This is needed for
+ * implementations overriding the #ClutterActorClass.get_paint_volume()
+ * virtual function and has to be called every time the paint volume
+ * returned by that function would change.
+ */
+void
+clutter_actor_invalidate_paint_volume (ClutterActor *self)
+{
+  g_return_if_fail (CLUTTER_IS_ACTOR (self));
+
+  self->priv->needs_paint_volume_update = TRUE;
+}
+
 gboolean
 clutter_actor_get_redraw_clip (ClutterActor       *self,
                                ClutterPaintVolume *dst_old_pv,
diff --git a/clutter/clutter/clutter-actor.h b/clutter/clutter/clutter-actor.h
index 39f96e2d5c..10b0a21748 100644
--- a/clutter/clutter/clutter-actor.h
+++ b/clutter/clutter/clutter-actor.h
@@ -931,6 +931,9 @@ GList * clutter_actor_peek_stage_views (ClutterActor *self);
 CLUTTER_EXPORT
 void clutter_actor_invalidate_transform (ClutterActor *self);
 
+CLUTTER_EXPORT
+void clutter_actor_invalidate_paint_volume (ClutterActor *self);
+
 G_END_DECLS
 
 #endif /* __CLUTTER_ACTOR_H__ */


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