aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <orzechowski.alexander@gmail.com>2022-08-16 07:06:17 -0400
committerAlexander Orzechowski <orzechowski.alexander@gmail.com>2022-08-19 16:18:46 -0400
commit6d1b8b376d1e4a5e1b4b07e53487533711988136 (patch)
tree0799ef5d06c7bac761dd7c488a2b841f67db6291
parent4d4f823263031cbef06f51547a5fe476e2eb5e38 (diff)
wlr_scene: Only enable black rect optimization if culling is enabled
If culling is not enabled, there is no longer any guarantee that the elements behind the rect won't be rendered. We must render the black rect in all circumstances to cover up anything rendered. This fixes the WLR_SCENE_DISABLE_VISIBILTY option.
-rw-r--r--types/scene/wlr_scene.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c
index ddd09a35..5c14aa66 100644
--- a/types/scene/wlr_scene.c
+++ b/types/scene/wlr_scene.c
@@ -1322,6 +1322,7 @@ static bool scene_node_invisible(struct wlr_scene_node *node) {
struct render_list_constructor_data {
struct wlr_box box;
struct wl_array *render_list;
+ bool calculate_visibility;
};
static bool construct_render_list_iterator(struct wlr_scene_node *node,
@@ -1335,7 +1336,7 @@ static bool construct_render_list_iterator(struct wlr_scene_node *node,
// while rendering, the background should always be black.
// If we see a black rect, we can ignore rendering everything under the rect
// and even the rect itself.
- if (node->type == WLR_SCENE_NODE_RECT) {
+ if (node->type == WLR_SCENE_NODE_RECT && data->calculate_visibility) {
struct wlr_scene_rect *rect = scene_rect_from_node(node);
float *black = (float[4]){ 0.f, 0.f, 0.f, 1.f };
@@ -1430,6 +1431,7 @@ bool wlr_scene_output_commit(struct wlr_scene_output *scene_output) {
struct render_list_constructor_data list_con = {
.box = { .x = scene_output->x, .y = scene_output->y },
.render_list = &scene_output->render_list,
+ .calculate_visibility = scene_output->scene->calculate_visibility,
};
wlr_output_effective_resolution(output,
&list_con.box.width, &list_con.box.height);