screencopy-v1: use wlr_renderer_begin_with_buffer

This commit is contained in:
Simon Ser 2021-06-08 09:14:34 +02:00
parent 69477051cc
commit a667175ec7
1 changed files with 6 additions and 9 deletions

View File

@ -9,7 +9,6 @@
#include <wlr/backend.h> #include <wlr/backend.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "wlr-screencopy-unstable-v1-protocol.h" #include "wlr-screencopy-unstable-v1-protocol.h"
#include "render/wlr_renderer.h"
#include "render/pixel_format.h" #include "render/pixel_format.h"
#include "util/signal.h" #include "util/signal.h"
@ -273,26 +272,24 @@ static bool blit_dmabuf(struct wlr_renderer *renderer,
goto error_src_tex; goto error_src_tex;
} }
if (!wlr_renderer_bind_buffer(renderer, dst_buffer)) {
goto error_bind_buffer;
}
float mat[9]; float mat[9];
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);
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_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);
wlr_renderer_end(renderer);
wlr_renderer_bind_buffer(renderer, NULL); wlr_renderer_end(renderer);
wlr_texture_destroy(src_tex); wlr_texture_destroy(src_tex);
wlr_buffer_unlock(dst_buffer); wlr_buffer_unlock(dst_buffer);
return true; return true;
error_bind_buffer: error_renderer_begin:
wlr_texture_destroy(src_tex); wlr_texture_destroy(src_tex);
error_src_tex: error_src_tex:
wlr_buffer_unlock(dst_buffer); wlr_buffer_unlock(dst_buffer);