aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-08-17 12:30:17 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2021-09-08 09:50:08 -0400
commit04d105760da71524c85a06f4ff7e5efba6a36088 (patch)
tree4512008646c30eab8e7282d826b4c5a2b7d2d080
parent968c1df7e978d57ad5d21bcf3c6506a465ae7de6 (diff)
scene: add wlr_scene_output_commit
-rw-r--r--include/wlr/types/wlr_scene.h4
-rw-r--r--types/wlr_scene.c24
2 files changed, 28 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_scene.h b/include/wlr/types/wlr_scene.h
index 6e3c13cd..f2773c6b 100644
--- a/include/wlr/types/wlr_scene.h
+++ b/include/wlr/types/wlr_scene.h
@@ -189,5 +189,9 @@ void wlr_scene_output_destroy(struct wlr_scene_output *scene_output);
*/
void wlr_scene_output_set_position(struct wlr_scene_output *scene_output,
int lx, int ly);
+/**
+ * Render and commit an output.
+ */
+bool wlr_scene_output_commit(struct wlr_scene_output *scene_output);
#endif
diff --git a/types/wlr_scene.c b/types/wlr_scene.c
index eb22d69d..4498c5f0 100644
--- a/types/wlr_scene.c
+++ b/types/wlr_scene.c
@@ -477,3 +477,27 @@ void wlr_scene_output_set_position(struct wlr_scene_output *scene_output,
scene_output->x = lx;
scene_output->y = ly;
}
+
+bool wlr_scene_output_commit(struct wlr_scene_output *scene_output) {
+ struct wlr_output *output = scene_output->output;
+
+ 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.0, 0.0, 0.0, 0.0 });
+
+ wlr_scene_render_output(scene_output->scene, output,
+ scene_output->x, scene_output->y, NULL);
+ wlr_output_render_software_cursors(output, NULL);
+
+ wlr_renderer_end(renderer);
+
+ return wlr_output_commit(output);
+}