[mutter/gnome-41] clutter/stage: Only add paint volumes of mapped actors to stage clip



commit 7f9defb4444e46aaaf8eda619f074403a27441e7
Author: Robert Mader <robert mader posteo de>
Date:   Sun Oct 3 21:17:49 2021 +0200

    clutter/stage: Only add paint volumes of mapped actors to stage clip
    
    Right now we damage the stage even if an actor is not mapped, for
    example in the overview.
    
    Stop doing so, reducing over-paint significantly in some situations.
    Clones will still do stage damage on their own.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2035>
    (cherry picked from commit 136caca5d51e0ac8ff5e7b79aca32d6da2306d4f)

 clutter/clutter/clutter-stage.c | 58 ++++++++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 27 deletions(-)
---
diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c
index c11eef8aab..ae920bee3f 100644
--- a/clutter/clutter/clutter-stage.c
+++ b/clutter/clutter/clutter-stage.c
@@ -2849,37 +2849,41 @@ clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage)
     {
       ClutterActor *redraw_actor = key;
       QueueRedrawEntry *entry = value;
-      ClutterPaintVolume old_actor_pv, new_actor_pv;
 
       g_hash_table_iter_steal (&iter);
 
-      _clutter_paint_volume_init_static (&old_actor_pv, NULL);
-      _clutter_paint_volume_init_static (&new_actor_pv, NULL);
-
-      if (entry->has_clip)
-        {
-          add_to_stage_clip (stage, &entry->clip);
-        }
-      else if (clutter_actor_get_redraw_clip (redraw_actor,
-                                              &old_actor_pv,
-                                              &new_actor_pv))
+      if (clutter_actor_is_mapped (redraw_actor))
         {
-          /* Add both the old paint volume of the actor (which is
-           * currently visible on the screen) and the new paint volume
-           * (which will be visible on the screen after this redraw)
-           * to the redraw clip.
-           * The former we do to ensure the old texture on the screen
-           * will be fully painted over in case the actor was moved.
-           */
-          add_to_stage_clip (stage, &old_actor_pv);
-          add_to_stage_clip (stage, &new_actor_pv);
-        }
-      else
-        {
-          /* If there's no clip we can use, we have to trigger an
-           * unclipped full stage redraw.
-           */
-          add_to_stage_clip (stage, NULL);
+          ClutterPaintVolume old_actor_pv, new_actor_pv;
+
+          _clutter_paint_volume_init_static (&old_actor_pv, NULL);
+          _clutter_paint_volume_init_static (&new_actor_pv, NULL);
+
+          if (entry->has_clip)
+            {
+              add_to_stage_clip (stage, &entry->clip);
+            }
+          else if (clutter_actor_get_redraw_clip (redraw_actor,
+                                                  &old_actor_pv,
+                                                  &new_actor_pv))
+            {
+              /* Add both the old paint volume of the actor (which is
+               * currently visible on the screen) and the new paint volume
+               * (which will be visible on the screen after this redraw)
+               * to the redraw clip.
+               * The former we do to ensure the old texture on the screen
+               * will be fully painted over in case the actor was moved.
+               */
+              add_to_stage_clip (stage, &old_actor_pv);
+              add_to_stage_clip (stage, &new_actor_pv);
+            }
+          else
+            {
+              /* If there's no clip we can use, we have to trigger an
+               * unclipped full stage redraw.
+               */
+              add_to_stage_clip (stage, NULL);
+            }
         }
 
       g_object_unref (redraw_actor);


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