From 7e383c6a6ae0c794a0e52148d237e90e9e0d5dff Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Wed, 6 Apr 2022 07:59:54 -0400 Subject: [PATCH] wlr_scene: Make wlr_scene_render_output private This function sidesteps damage tracking and output awareness on buffers/surfaces. This function isn't a great fit for the API. Let's also inline the function and simplify it. --- include/wlr/types/wlr_scene.h | 8 -------- types/scene/wlr_scene.c | 36 +++++++++-------------------------- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h index b48aeff8..c4b171e3 100644 --- a/include/wlr/types/wlr_scene.h +++ b/include/wlr/types/wlr_scene.h @@ -225,14 +225,6 @@ struct wlr_scene_node *wlr_scene_node_at(struct wlr_scene_node *node, * Create a new scene-graph. */ struct wlr_scene *wlr_scene_create(void); -/** - * Manually render the scene-graph on an output. The compositor needs to call - * wlr_renderer_begin before and wlr_renderer_end after calling this function. - * Damage is given in output-buffer-local coordinates and can be set to NULL to - * disable damage tracking. - */ -void wlr_scene_render_output(struct wlr_scene *scene, struct wlr_output *output, - int lx, int ly, pixman_region32_t *damage); /** * Handle presentation feedback for all surfaces in the scene, assuming that * scene outputs and the scene rendering functions are used. diff --git a/types/scene/wlr_scene.c b/types/scene/wlr_scene.c index 52d8d00b..3de721f7 100644 --- a/types/scene/wlr_scene.c +++ b/types/scene/wlr_scene.c @@ -945,31 +945,6 @@ static void scene_node_for_each_node(struct wlr_scene_node *node, } } -void wlr_scene_render_output(struct wlr_scene *scene, struct wlr_output *output, - int lx, int ly, pixman_region32_t *damage) { - pixman_region32_t full_region; - pixman_region32_init_rect(&full_region, 0, 0, output->width, output->height); - if (damage == NULL) { - damage = &full_region; - } - - struct wlr_renderer *renderer = output->renderer; - assert(renderer); - - if (output->enabled && pixman_region32_not_empty(damage)) { - struct render_data data = { - .output = output, - .damage = damage, - .presentation = scene->presentation, - }; - scene_node_for_each_node(&scene->node, -lx, -ly, - render_node_iterator, &data); - wlr_renderer_scissor(renderer, NULL); - } - - pixman_region32_fini(&full_region); -} - static void scene_handle_presentation_destroy(struct wl_listener *listener, void *data) { struct wlr_scene *scene = @@ -1254,8 +1229,15 @@ bool wlr_scene_output_commit(struct wlr_scene_output *scene_output) { wlr_renderer_clear(renderer, (float[4]){ 0.0, 0.0, 0.0, 1.0 }); } - wlr_scene_render_output(scene_output->scene, output, - scene_output->x, scene_output->y, &damage); + struct render_data data = { + .output = output, + .damage = &damage, + .presentation = scene_output->scene->presentation, + }; + scene_node_for_each_node(&scene_output->scene->node, + -scene_output->x, -scene_output->y, + render_node_iterator, &data); + wlr_renderer_scissor(renderer, NULL); wlr_output_render_software_cursors(output, &damage); wlr_renderer_end(renderer);