aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-10-03 11:37:55 +0200
committerAlexander Orzechowski <orzechowski.alexander@gmail.com>2022-10-03 17:06:38 +0000
commit50cc1ef4d3791d86854dd83c15fff17e5ea1a5b6 (patch)
tree9c4fdcfdae4fcebcb40f1df0d20c9fda08865157
parent0af4affd0b838f31e8ea61a32a157fafdc563f7f (diff)
screencopy-v1: simplify frame_dma_copy() error path
Unify success and error code-paths.
-rw-r--r--types/wlr_screencopy_v1.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c
index 530cacb5..88290eee 100644
--- a/types/wlr_screencopy_v1.c
+++ b/types/wlr_screencopy_v1.c
@@ -248,21 +248,20 @@ static bool frame_dma_copy(struct wlr_screencopy_frame_v1 *frame,
wlr_matrix_identity(mat);
wlr_matrix_scale(mat, dst_buffer->width, dst_buffer->height);
+ bool ok = false;
if (!wlr_renderer_begin_with_buffer(renderer, dst_buffer)) {
- goto error_renderer_begin;
+ goto out;
}
wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 0.0 });
wlr_render_texture_with_matrix(renderer, src_tex, mat, 1.0f);
+ ok = true;
wlr_renderer_end(renderer);
+out:
wlr_texture_destroy(src_tex);
- return true;
-
-error_renderer_begin:
- wlr_texture_destroy(src_tex);
- return false;
+ return ok;
}
static void frame_handle_output_commit(struct wl_listener *listener,