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>
This commit is contained in:
Robert Mader 2021-10-03 21:17:49 +02:00 committed by Marge Bot
parent b41def4749
commit 136caca5d5

View File

@ -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);