output: use wlr_renderer_begin_with_buffer for cursor

This commit is contained in:
Simon Ser 2021-06-08 09:15:17 +02:00
parent a667175ec7
commit fbadadf36f
1 changed files with 6 additions and 8 deletions

View File

@ -1263,11 +1263,6 @@ static struct wlr_buffer *render_cursor_buffer(struct wlr_output_cursor *cursor)
return NULL; return NULL;
} }
if (!wlr_renderer_bind_buffer(renderer, buffer)) {
wlr_buffer_unlock(buffer);
return NULL;
}
struct wlr_box cursor_box = { struct wlr_box cursor_box = {
.width = texture->width * output->scale / scale, .width = texture->width * output->scale / scale,
.height = texture->height * output->scale / scale, .height = texture->height * output->scale / scale,
@ -1292,12 +1287,15 @@ static struct wlr_buffer *render_cursor_buffer(struct wlr_output_cursor *cursor)
float matrix[9]; float matrix[9];
wlr_matrix_project_box(matrix, &cursor_box, transform, 0, output_matrix); wlr_matrix_project_box(matrix, &cursor_box, transform, 0, output_matrix);
wlr_renderer_begin(renderer, width, height); if (!wlr_renderer_begin_with_buffer(renderer, buffer)) {
wlr_buffer_unlock(buffer);
return NULL;
}
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, texture, matrix, 1.0); wlr_render_texture_with_matrix(renderer, texture, matrix, 1.0);
wlr_renderer_end(renderer);
wlr_renderer_bind_buffer(renderer, NULL); wlr_renderer_end(renderer);
return buffer; return buffer;
} }