diff options
author | Simon Ser <contact@emersion.fr> | 2021-06-29 20:11:53 +0200 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-07-01 14:57:52 -0400 |
commit | 29c8df7e0a3e6ac1720cd843ba6f523de6b71c0a (patch) | |
tree | 56805dd677408b637f34f1d16e441bd655b3fa62 | |
parent | 7ec66a9990cfe1a932fb28d0f65e5d142db04e26 (diff) |
render: use wlr_readonly_data_buffer in wlr_texture_from_pixels
-rw-r--r-- | render/wlr_texture.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/render/wlr_texture.c b/render/wlr_texture.c index b2acfcb4..73c1d8f3 100644 --- a/render/wlr_texture.c +++ b/render/wlr_texture.c @@ -3,6 +3,7 @@ #include <stdlib.h> #include <wlr/render/interface.h> #include <wlr/render/wlr_texture.h> +#include "types/wlr_buffer.h" #include "render/wlr_texture.h" void wlr_texture_init(struct wlr_texture *texture, @@ -27,8 +28,21 @@ struct wlr_texture *wlr_texture_from_pixels(struct wlr_renderer *renderer, assert(height > 0); assert(stride > 0); assert(data); - return renderer->impl->texture_from_pixels(renderer, fmt, stride, width, - height, data); + + struct wlr_readonly_data_buffer *buffer = + readonly_data_buffer_create(fmt, stride, width, height, data); + if (buffer == NULL) { + return NULL; + } + + struct wlr_texture *texture = + wlr_texture_from_buffer(renderer, &buffer->base); + + // By this point, the renderer should have locked the buffer if it still + // needs to access it in the future. + readonly_data_buffer_drop(buffer); + + return texture; } struct wlr_texture *wlr_texture_from_wl_drm(struct wlr_renderer *renderer, |