summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <[email protected]>2022-08-16 07:06:17 -0400
committerAlexander Orzechowski <[email protected]>2022-08-19 16:18:46 -0400
commit59db20b014320e86bc047c81c8eae6511a10d09a (patch)
tree372612cab51e9392ce63feae6542b81c320be542
parent4fd0b08bf3c3f2da2a1c89dd54f25553a43ea3a6 (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--wlr_scene.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/wlr_scene.c b/wlr_scene.c
index ddd09a3..5c14aa6 100644
--- a/wlr_scene.c
+++ b/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);