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 136caca5d5)
This commit is contained in:
Robert Mader 2021-10-03 21:17:49 +02:00 committed by Florian Müllner
parent c33ca49dfc
commit 7f9defb444

View File

@ -2849,37 +2849,41 @@ clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage)
{ {
ClutterActor *redraw_actor = key; ClutterActor *redraw_actor = key;
QueueRedrawEntry *entry = value; QueueRedrawEntry *entry = value;
ClutterPaintVolume old_actor_pv, new_actor_pv;
g_hash_table_iter_steal (&iter); g_hash_table_iter_steal (&iter);
_clutter_paint_volume_init_static (&old_actor_pv, NULL); if (clutter_actor_is_mapped (redraw_actor))
_clutter_paint_volume_init_static (&new_actor_pv, NULL); {
ClutterPaintVolume old_actor_pv, new_actor_pv;
if (entry->has_clip) _clutter_paint_volume_init_static (&old_actor_pv, NULL);
{ _clutter_paint_volume_init_static (&new_actor_pv, NULL);
add_to_stage_clip (stage, &entry->clip);
} if (entry->has_clip)
else if (clutter_actor_get_redraw_clip (redraw_actor, {
&old_actor_pv, add_to_stage_clip (stage, &entry->clip);
&new_actor_pv)) }
{ else if (clutter_actor_get_redraw_clip (redraw_actor,
/* Add both the old paint volume of the actor (which is &old_actor_pv,
* currently visible on the screen) and the new paint volume &new_actor_pv))
* (which will be visible on the screen after this redraw) {
* to the redraw clip. /* Add both the old paint volume of the actor (which is
* The former we do to ensure the old texture on the screen * currently visible on the screen) and the new paint volume
* will be fully painted over in case the actor was moved. * (which will be visible on the screen after this redraw)
*/ * to the redraw clip.
add_to_stage_clip (stage, &old_actor_pv); * The former we do to ensure the old texture on the screen
add_to_stage_clip (stage, &new_actor_pv); * will be fully painted over in case the actor was moved.
} */
else add_to_stage_clip (stage, &old_actor_pv);
{ add_to_stage_clip (stage, &new_actor_pv);
/* If there's no clip we can use, we have to trigger an }
* unclipped full stage redraw. else
*/ {
add_to_stage_clip (stage, NULL); /* 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); g_object_unref (redraw_actor);