screencopy-v1: simplify frame_dma_copy() error path

Unify success and error code-paths.
This commit is contained in:
Simon Ser 2022-10-03 11:37:55 +02:00 committed by Alexander Orzechowski
parent 0af4affd0b
commit 50cc1ef4d3

View file

@ -248,21 +248,20 @@ static bool frame_dma_copy(struct wlr_screencopy_frame_v1 *frame,
wlr_matrix_identity(mat); wlr_matrix_identity(mat);
wlr_matrix_scale(mat, dst_buffer->width, dst_buffer->height); wlr_matrix_scale(mat, dst_buffer->width, dst_buffer->height);
bool ok = false;
if (!wlr_renderer_begin_with_buffer(renderer, dst_buffer)) { 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_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 0.0 });
wlr_render_texture_with_matrix(renderer, src_tex, mat, 1.0f); wlr_render_texture_with_matrix(renderer, src_tex, mat, 1.0f);
ok = true;
wlr_renderer_end(renderer); wlr_renderer_end(renderer);
out:
wlr_texture_destroy(src_tex); wlr_texture_destroy(src_tex);
return true; return ok;
error_renderer_begin:
wlr_texture_destroy(src_tex);
return false;
} }
static void frame_handle_output_commit(struct wl_listener *listener, static void frame_handle_output_commit(struct wl_listener *listener,