diff options
author | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-07-06 17:02:04 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-07-09 23:16:39 +0200 |
commit | 6d8029b07e0876de5290fb14c259df9a2d5e65cb (patch) | |
tree | ef97e54a919a08e3238965075cd03e6ea0cf8e86 /include/wlr | |
parent | f67cfb2ce288e7fd24c22a372e95939ce120e81c (diff) |
types/wlr_buffer: split wlr_client_buffer_import function
`wlr_client_buffer_import` is splitted in two distincts function:
- wlr_buffer_from_resource, which transforms a wl_resource into
a wlr_buffer
- wlr_client_buffer_create, which creates a wlr_client_buffer
from a wlr_buffer by creating a texture from it and copying its
wl_resource
Diffstat (limited to 'include/wlr')
-rw-r--r-- | include/wlr/types/wlr_buffer.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/include/wlr/types/wlr_buffer.h b/include/wlr/types/wlr_buffer.h index c293eb6a..d0df0380 100644 --- a/include/wlr/types/wlr_buffer.h +++ b/include/wlr/types/wlr_buffer.h @@ -14,6 +14,7 @@ #include <wlr/render/dmabuf.h> struct wlr_buffer; +struct wlr_renderer; struct wlr_shm_attributes { int fd; @@ -111,6 +112,14 @@ bool wlr_buffer_get_dmabuf(struct wlr_buffer *buffer, */ bool wlr_buffer_get_shm(struct wlr_buffer *buffer, struct wlr_shm_attributes *attribs); +/** + * Transforms a wl_resource into a wlr_buffer and locks it. Once the caller is + * done with the buffer, they must call wlr_buffer_unlock. + * + * The provided wl_resource must be a wl_buffer. + */ +struct wlr_buffer *wlr_buffer_from_resource(struct wlr_renderer *renderer, + struct wl_resource *resource); /** * A client buffer. @@ -131,7 +140,12 @@ struct wlr_client_buffer { struct wl_listener resource_destroy; }; -struct wlr_renderer; +/** + * Creates a wlr_client_buffer from a given wlr_buffer by creating a texture + * from it, and copying its wl_resource. + */ +struct wlr_client_buffer *wlr_client_buffer_create(struct wlr_buffer *buffer, + struct wlr_renderer *renderer, struct wl_resource *resource); /** * Get a client buffer from a generic buffer. If the buffer isn't a client @@ -148,13 +162,6 @@ bool wlr_resource_is_buffer(struct wl_resource *resource); bool wlr_resource_get_buffer_size(struct wl_resource *resource, int *width, int *height); /** - * Import a client buffer and lock it. - * - * Once the caller is done with the buffer, they must call wlr_buffer_unlock. - */ -struct wlr_client_buffer *wlr_client_buffer_import( - struct wlr_renderer *renderer, struct wl_resource *resource); -/** * Try to update the buffer's content. On success, returns the updated buffer * and destroys the provided `buffer`. On error, `buffer` is intact and NULL is * returned. |