mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
screencopy-v1: use wlr_renderer_begin_with_buffer
This commit is contained in:
parent
69477051cc
commit
a667175ec7
1 changed files with 6 additions and 9 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue