mutter/0001-Revert-clutter-actor-Cache-stage-relative-instead-of.patch

145 lines
5.5 KiB
Diff

From d11feddbb29f0bf6de104d8d5c54cf18f3ca96da Mon Sep 17 00:00:00 2001
From: Alynx Zhou <alynx.zhou@gmail.com>
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(-)
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index dd0d5ceb6..70dea5ca2 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -612,7 +612,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;
@@ -776,7 +776,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
@@ -2425,7 +2425,7 @@ absolute_geometry_changed (ClutterActor *actor)
{
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
@@ -3047,9 +3047,8 @@ _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
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
@@ -3058,63 +3057,37 @@ _clutter_actor_apply_relative_transformation_matrix (ClutterActor *self,
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;
}
@@ -7469,7 +7442,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
--
2.44.0