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




commit 08fcaa746eee68b3059ddabeb1fd50f7ecaa127e
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 79f4565edb..6044382699 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 */


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