From 7f9defb4444e46aaaf8eda619f074403a27441e7 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Sun, 3 Oct 2021 21:17:49 +0200 Subject: [PATCH] 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: (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 c11eef8aa..ae920bee3 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 (clutter_actor_is_mapped (redraw_actor)) + { + ClutterPaintVolume old_actor_pv, new_actor_pv; - 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); + _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);