[mutter/gbsneto/graphene-ray: 40/40] clutter/actor: Don't push identity transforms




commit 5540bf5e64793d1bf811d52a01780b6e02ef3ba3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sun Oct 18 14:29:13 2020 -0300

    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

 clutter/clutter/clutter-actor.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index ee3d1b1680..1d3fddddc3 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -3947,6 +3947,7 @@ clutter_actor_pick (ClutterActor       *actor,
 {
   ClutterActorPrivate *priv;
   ClutterActorBox clip;
+  gboolean transform_pushed = FALSE;
   gboolean clip_set = FALSE;
 
   if (CLUTTER_ACTOR_IN_DESTRUCTION (actor))
@@ -3969,7 +3970,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)
@@ -4004,7 +4009,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 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]