summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2020-10-18 14:29:13 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2020-10-26 10:19:04 -0300
commitda7671b547ba9fa407fb7e0b313048354d92e840 (patch)
tree14b17bbdb40fa3b9ed2f0843b45089442b3b4dae
parentce6f13357af3a2a87d32b64348b36f51f615eb72 (diff)
downloadmutter-da7671b547ba9fa407fb7e0b313048354d92e840.tar.gz
clutter/actor: Don't push identity transforms
It is useless, and needlessly increases the matrix stack and does more multiplications than necessary. Don't push identity transforms to the pick stack. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1509
-rw-r--r--clutter/clutter/clutter-actor.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index 79f4565ed..604438269 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -3931,6 +3931,7 @@ clutter_actor_pick (ClutterActor *actor,
{
ClutterActorPrivate *priv;
ClutterActorBox clip;
+ gboolean transform_pushed = FALSE;
gboolean clip_set = FALSE;
if (CLUTTER_ACTOR_IN_DESTRUCTION (actor))
@@ -3953,7 +3954,11 @@ clutter_actor_pick (ClutterActor *actor,
graphene_matrix_init_identity (&matrix);
_clutter_actor_apply_modelview_transform (actor, &matrix);
- clutter_pick_context_push_transform (pick_context, &matrix);
+ if (!graphene_matrix_is_identity (&matrix))
+ {
+ clutter_pick_context_push_transform (pick_context, &matrix);
+ transform_pushed = TRUE;
+ }
}
if (priv->has_clip)
@@ -3988,7 +3993,7 @@ clutter_actor_pick (ClutterActor *actor,
if (clip_set)
clutter_pick_context_pop_clip (pick_context);
- if (priv->enable_model_view_transform)
+ if (transform_pushed)
clutter_pick_context_pop_transform (pick_context);
/* paint sequence complete */