From 7aa147829de1dddcdacf416da358c7a4a9a94c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Sat, 24 Oct 2020 13:20:26 +0200 Subject: [PATCH] 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: --- 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 0a0884415..7aac4ab84 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 39f96e2d5..10b0a2174 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__ */