From d11feddbb29f0bf6de104d8d5c54cf18f3ca96da Mon Sep 17 00:00:00 2001 From: Alynx Zhou Date: Thu, 14 Mar 2024 19:20:57 +0800 Subject: [PATCH] Revert "clutter/actor: Cache stage-relative instead of absolute modelviews" This reverts commit 703bbe0e99dbb688352e0bff396e5cbf2c6af45b. --- clutter/clutter/clutter-actor.c | 67 ++++++++++----------------------- 1 file changed, 20 insertions(+), 47 deletions(-) Index: mutter-46.3/clutter/clutter/clutter-actor.c =================================================================== --- mutter-46.3.orig/clutter/clutter/clutter-actor.c +++ mutter-46.3/clutter/clutter/clutter-actor.c @@ -566,7 +566,7 @@ struct _ClutterActorPrivate /* the cached transformation matrix; see apply_transform() */ graphene_matrix_t transform; - graphene_matrix_t stage_relative_modelview; + graphene_matrix_t absolute_modelview; float resource_scale; @@ -730,7 +730,7 @@ struct _ClutterActorPrivate guint clear_stage_views_needs_stage_views_changed : 1; guint needs_redraw : 1; guint needs_finish_layout : 1; - guint stage_relative_modelview_valid : 1; + guint absolute_modelview_valid : 1; }; enum @@ -2309,7 +2309,7 @@ absolute_geometry_changed (ClutterActor { actor->priv->needs_update_stage_views = TRUE; actor->priv->needs_visible_paint_volume_update = TRUE; - actor->priv->stage_relative_modelview_valid = FALSE; + actor->priv->absolute_modelview_valid = FALSE; actor->priv->needs_finish_layout = TRUE; /* needs_finish_layout is already TRUE on the whole parent tree thanks @@ -2931,9 +2931,8 @@ _clutter_actor_apply_relative_transforma graphene_matrix_t *matrix) { ClutterActorPrivate *priv = self->priv; - ClutterActor *stage = _clutter_actor_get_stage_internal (self); - graphene_matrix_t ancestor_modelview; - graphene_matrix_t inverse_ancestor_modelview; + graphene_matrix_t parent_modelview; + graphene_matrix_t inverse_parent_modelview; /* Note we terminate before ever calling stage->apply_transform() * since that would conceptually be relative to the underlying @@ -2942,63 +2941,37 @@ _clutter_actor_apply_relative_transforma if (self == ancestor) return; - if (!priv->stage_relative_modelview_valid) + if (!priv->absolute_modelview_valid) { - graphene_matrix_init_identity (&priv->stage_relative_modelview); + graphene_matrix_init_identity (&priv->absolute_modelview); if (priv->parent != NULL) { _clutter_actor_apply_relative_transformation_matrix (priv->parent, - stage, - &priv->stage_relative_modelview); + NULL, + &priv->absolute_modelview); } - _clutter_actor_apply_modelview_transform (self, - &priv->stage_relative_modelview); + _clutter_actor_apply_modelview_transform (self, &priv->absolute_modelview); - priv->stage_relative_modelview_valid = TRUE; + priv->absolute_modelview_valid = TRUE; } if (ancestor == NULL) { - _clutter_actor_apply_modelview_transform (stage, matrix); - graphene_matrix_multiply (&priv->stage_relative_modelview, matrix, matrix); - return; - } - - if (ancestor == stage) - { - graphene_matrix_multiply (&priv->stage_relative_modelview, matrix, matrix); - return; - } - - if (ancestor == priv->parent) - { - _clutter_actor_apply_modelview_transform (self, matrix); + graphene_matrix_multiply (&priv->absolute_modelview, matrix, matrix); return; } - graphene_matrix_init_identity (&ancestor_modelview); + graphene_matrix_init_identity (&parent_modelview); _clutter_actor_apply_relative_transformation_matrix (ancestor, - stage, - &ancestor_modelview); - - if (graphene_matrix_near (&priv->stage_relative_modelview, - &ancestor_modelview, - FLT_EPSILON)) - return; - - if (graphene_matrix_is_identity (&ancestor_modelview)) - { - graphene_matrix_multiply (&priv->stage_relative_modelview, matrix, matrix); - return; - } - - if (graphene_matrix_inverse (&ancestor_modelview, - &inverse_ancestor_modelview)) + NULL, + &parent_modelview); + if (graphene_matrix_inverse (&parent_modelview, + &inverse_parent_modelview)) { - graphene_matrix_multiply (&inverse_ancestor_modelview, matrix, matrix); - graphene_matrix_multiply (&priv->stage_relative_modelview, matrix, matrix); + graphene_matrix_multiply (&inverse_parent_modelview, matrix, matrix); + graphene_matrix_multiply (&priv->absolute_modelview, matrix, matrix); return; } @@ -7362,7 +7335,7 @@ clutter_actor_init (ClutterActor *self) priv->enable_model_view_transform = TRUE; priv->transform_valid = FALSE; - priv->stage_relative_modelview_valid = FALSE; + priv->absolute_modelview_valid = FALSE; /* the default is to stretch the content, to match the * current behaviour of basically all actors. also, it's