From 028606512dfe9fe9d565f600669d06c35aa20f3a Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Sat, 25 Jun 2022 17:58:13 -0400 Subject: [PATCH] wlr_scene: Add per scene node visibility --- include/wlr/types/wlr_scene.h | 4 ++++ types/scene/wlr_scene.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h index a8737921..da0a794a 100644 --- a/include/wlr/types/wlr_scene.h +++ b/include/wlr/types/wlr_scene.h @@ -64,6 +64,10 @@ struct wlr_scene_node { void *data; struct wlr_addon_set addons; + + // private state + + pixman_region32_t visible; }; enum wlr_scene_debug_damage_option { diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 4f62a882..f4815ece 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -58,6 +58,7 @@ static void scene_node_init(struct wlr_scene_node *node, wl_list_init(&node->link); wl_signal_init(&node->events.destroy); + pixman_region32_init(&node->visible); if (parent != NULL) { wl_list_insert(parent->children.prev, &node->link); @@ -127,6 +128,7 @@ void wlr_scene_node_destroy(struct wlr_scene_node *node) { wlr_addon_set_finish(&node->addons); wl_list_remove(&node->link); + pixman_region32_fini(&node->visible); free(node); } @@ -610,6 +612,9 @@ static void _scene_node_damage_whole(struct wlr_scene_node *node, int width, height; scene_node_get_size(node, &width, &height); + pixman_region32_fini(&node->visible); + pixman_region32_init_rect(&node->visible, lx, ly, width, height); + struct wlr_scene_output *scene_output; wl_list_for_each(scene_output, &scene->outputs, link) { struct wlr_box box = {