aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-06-19 02:00:59 -0400
committerAlexander Orzechowski <alex@ozal.ski>2023-11-30 20:01:12 -0500
commit8ac51390073294f24b71e6dfbc96c4d8cf595eb2 (patch)
treeccc42d98e1f19b2e3c8bbd8ad5a753714a0eba38
parentc5a3c5ca4cc4ee664bb4b4edad77dba8c36b0a21 (diff)
backend/x11: Use wlr_texture_read_pixels
-rw-r--r--backend/x11/output.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/backend/x11/output.c b/backend/x11/output.c
index 58c90a89..db63f82f 100644
--- a/backend/x11/output.c
+++ b/backend/x11/output.c
@@ -448,25 +448,26 @@ static bool output_cursor_to_picture(struct wlr_x11_output *output,
return true;
}
- int depth = 32;
- int stride = buffer->width * 4;
-
- uint8_t *data = malloc(buffer->height * stride);
- if (data == NULL) {
+ struct wlr_texture *texture = wlr_texture_from_buffer(renderer, buffer);
+ if (!texture) {
return false;
}
- if (!wlr_renderer_begin_with_buffer(renderer, buffer)) {
- free(data);
+ int depth = 32;
+ int stride = texture->width * 4;
+ uint8_t *data = malloc(texture->height * stride);
+ if (data == NULL) {
+ wlr_texture_destroy(texture);
return false;
}
- bool result = wlr_renderer_read_pixels(
- renderer, DRM_FORMAT_ARGB8888,
- stride, buffer->width, buffer->height, 0, 0, 0, 0,
- data);
+ bool result = wlr_texture_read_pixels(texture, &(struct wlr_texture_read_pixels_options) {
+ .format = DRM_FORMAT_ARGB8888,
+ .stride = stride,
+ .data = data,
+ });
- wlr_renderer_end(renderer);
+ wlr_texture_destroy(texture);
if (!result) {
free(data);