clutter/actor: Introduce notify_transform_invalid

This allows clients to maybe avoid triggering a redraw if they don't know
beforehand if the transform would actually change.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2726>
This commit is contained in:
msizanoen1 2022-12-04 11:14:21 +07:00 committed by Marge Bot
parent 875922fbe3
commit ddc5de610b
2 changed files with 36 additions and 0 deletions

View File

@ -19184,3 +19184,36 @@ void clutter_actor_set_implicitly_grabbed (ClutterActor *self,
g_assert (priv->implicitly_grabbed_count >= 0);
}
/**
* clutter_actor_notify_transform_invalid:
* @self: A #ClutterActor
*
* Invalidate the cached transformation matrix of @self and queue a redraw
* if the transformation matrix has changed.
* This is needed for implementations overriding the apply_transform()
* vfunc and has to be called if the matrix returned by apply_transform()
* would change due to state outside of the object itself.
*/
void
clutter_actor_notify_transform_invalid (ClutterActor *self)
{
ClutterActorPrivate *priv = self->priv;
graphene_matrix_t old_transform;
if (!priv->transform_valid)
{
clutter_actor_queue_redraw (self);
return;
}
graphene_matrix_init_from_matrix (&old_transform, &priv->transform);
transform_changed (self);
ensure_valid_actor_transform (self);
g_assert (priv->transform_valid);
if (!graphene_matrix_equal (&old_transform, &priv->transform))
clutter_actor_queue_redraw (self);
}

View File

@ -132,6 +132,9 @@ void clutter_get_debug_flags (ClutterDebugFlag *debug_flags,
ClutterDrawDebugFlag *draw_flags,
ClutterPickDebugFlag *pick_flags);
CLUTTER_EXPORT
void clutter_actor_notify_transform_invalid (ClutterActor *self);
#undef __CLUTTER_H_INSIDE__
#endif /* __CLUTTER_MUTTER_H__ */