diff options
author | Simon Ser <contact@emersion.fr> | 2021-06-08 09:14:34 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-06-09 10:26:09 +0200 |
commit | a667175ec7d6f04c7d3a5f8db0bf7c5bed432152 (patch) | |
tree | e954c3d0ea84ade51f0a877fa426493c66dd7af1 | |
parent | 69477051ccffe179d11d5f23ede9b348abb2e8d3 (diff) |
screencopy-v1: use wlr_renderer_begin_with_buffer
-rw-r--r-- | types/wlr_screencopy_v1.c | 15 |
1 files 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 <wlr/backend.h> #include <wlr/util/log.h> #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); |