From a667175ec7d6f04c7d3a5f8db0bf7c5bed432152 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 8 Jun 2021 09:14:34 +0200 Subject: screencopy-v1: use wlr_renderer_begin_with_buffer --- types/wlr_screencopy_v1.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c index 2aad103f..ba55bbe2 100644 --- a/types/wlr_screencopy_v1.c +++ b/types/wlr_screencopy_v1.c @@ -9,7 +9,6 @@ #include #include #include "wlr-screencopy-unstable-v1-protocol.h" -#include "render/wlr_renderer.h" #include "render/pixel_format.h" #include "util/signal.h" @@ -273,26 +272,24 @@ static bool blit_dmabuf(struct wlr_renderer *renderer, goto error_src_tex; } - if (!wlr_renderer_bind_buffer(renderer, dst_buffer)) { - goto error_bind_buffer; - } - float mat[9]; wlr_matrix_identity(mat); wlr_matrix_scale(mat, dst_buffer->width, dst_buffer->height); - wlr_renderer_begin(renderer, dst_buffer->width, dst_buffer->height); + if (!wlr_renderer_begin_with_buffer(renderer, dst_buffer)) { + goto error_renderer_begin; + } + 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_renderer_end(renderer); - wlr_renderer_bind_buffer(renderer, NULL); + wlr_renderer_end(renderer); wlr_texture_destroy(src_tex); wlr_buffer_unlock(dst_buffer); return true; -error_bind_buffer: +error_renderer_begin: wlr_texture_destroy(src_tex); error_src_tex: wlr_buffer_unlock(dst_buffer); -- cgit v1.2.3