From 6d62300324593ae123e04343cb949029a1bd4990 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Sat, 25 Jun 2022 18:22:00 -0400 Subject: [PATCH] wlr_scene_set_buffer_with_damage: Only damage the visible parts of the node --- types/scene/wlr_scene.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 498fa878..94d0c02c 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -577,6 +577,14 @@ void wlr_scene_buffer_set_buffer_with_damage(struct wlr_scene_buffer *scene_buff pixman_region32_init(&output_damage); wlr_region_scale_xy(&output_damage, &trans_damage, output_scale * scale_x, output_scale * scale_y); + + pixman_region32_t cull_region; + pixman_region32_init(&cull_region); + wlr_region_scale(&cull_region, &scene_buffer->node.visible, output_scale); + pixman_region32_translate(&cull_region, -lx * output_scale, -ly * output_scale); + pixman_region32_intersect(&output_damage, &output_damage, &cull_region); + pixman_region32_fini(&cull_region); + pixman_region32_translate(&output_damage, (lx - scene_output->x) * output_scale, (ly - scene_output->y) * output_scale);