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>
This commit is contained in:
Jonas Dreßler 2020-10-24 13:20:26 +02:00 committed by Marge Bot
parent a796edd892
commit 7aa147829d
2 changed files with 20 additions and 0 deletions

View File

@ -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,

View File

@ -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__ */