mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-09 13:29:46 -05:00
scene: add wlr_scene_commit_output
This function performs an output commit. Since it's higher level than wlr_scene_render, it can take care of damage tracking and output layers.
This commit is contained in:
parent
33aaa24b6b
commit
68644f26bc
2 changed files with 26 additions and 0 deletions
|
|
@ -103,6 +103,11 @@ struct wlr_scene *wlr_scene_create(void);
|
||||||
*/
|
*/
|
||||||
void wlr_scene_render(struct wlr_scene *scene, struct wlr_output *output,
|
void wlr_scene_render(struct wlr_scene *scene, struct wlr_output *output,
|
||||||
int lx, int ly, pixman_region32_t *damage);
|
int lx, int ly, pixman_region32_t *damage);
|
||||||
|
/**
|
||||||
|
* Perform an output commit.
|
||||||
|
*/
|
||||||
|
bool wlr_scene_commit_output(struct wlr_scene *scene, struct wlr_output *output,
|
||||||
|
int lx, int ly);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a node displaying a surface (and its sub-surfaces) to the scene-graph.
|
* Add a node displaying a surface (and its sub-surfaces) to the scene-graph.
|
||||||
|
|
|
||||||
|
|
@ -308,3 +308,24 @@ void wlr_scene_render(struct wlr_scene *scene, struct wlr_output *output,
|
||||||
|
|
||||||
pixman_region32_fini(&full_region);
|
pixman_region32_fini(&full_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wlr_scene_commit_output(struct wlr_scene *scene, struct wlr_output *output,
|
||||||
|
int lx, int ly) {
|
||||||
|
if (!wlr_output_attach_render(output, NULL)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct wlr_renderer *renderer = wlr_backend_get_renderer(output->backend);
|
||||||
|
assert(renderer != NULL);
|
||||||
|
|
||||||
|
int width, height;
|
||||||
|
wlr_output_effective_resolution(output, &width, &height);
|
||||||
|
wlr_renderer_begin(renderer, width, height);
|
||||||
|
wlr_renderer_clear(renderer, (float[4]){ 0.3, 0.3, 0.3, 1.0 });
|
||||||
|
|
||||||
|
wlr_scene_render(scene, output, lx, ly, NULL);
|
||||||
|
|
||||||
|
wlr_renderer_end(renderer);
|
||||||
|
|
||||||
|
return wlr_output_commit(output);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue