mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 22:55:58 +01:00
buffer: improve docs
This commit is contained in:
parent
e4933ab445
commit
7d24af43e5
1 changed files with 29 additions and 9 deletions
|
@ -4,9 +4,12 @@
|
||||||
#include <pixman.h>
|
#include <pixman.h>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A client buffer.
|
||||||
|
*/
|
||||||
struct wlr_buffer {
|
struct wlr_buffer {
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource; // can be NULL
|
||||||
struct wlr_texture *texture;
|
struct wlr_texture *texture; // can be NULL
|
||||||
bool released;
|
bool released;
|
||||||
size_t n_refs;
|
size_t n_refs;
|
||||||
|
|
||||||
|
@ -15,21 +18,38 @@ struct wlr_buffer {
|
||||||
|
|
||||||
struct wlr_renderer;
|
struct wlr_renderer;
|
||||||
|
|
||||||
// Checks if a resource is a wl_buffer.
|
/**
|
||||||
|
* Check if a resource is a wl_buffer resource.
|
||||||
|
*/
|
||||||
bool wlr_resource_is_buffer(struct wl_resource *resource);
|
bool wlr_resource_is_buffer(struct wl_resource *resource);
|
||||||
// Returns the buffer size.
|
/**
|
||||||
|
* Get the size of a wl_buffer resource.
|
||||||
|
*/
|
||||||
bool wlr_buffer_get_resource_size(struct wl_resource *resource,
|
bool wlr_buffer_get_resource_size(struct wl_resource *resource,
|
||||||
struct wlr_renderer *renderer, int *width, int *height);
|
struct wlr_renderer *renderer, int *width, int *height);
|
||||||
|
|
||||||
// Uploads the texture to the GPU and references it.
|
/**
|
||||||
|
* Upload a buffer to the GPU and reference it.
|
||||||
|
*/
|
||||||
struct wlr_buffer *wlr_buffer_create(struct wlr_renderer *renderer,
|
struct wlr_buffer *wlr_buffer_create(struct wlr_renderer *renderer,
|
||||||
struct wl_resource *resource);
|
struct wl_resource *resource);
|
||||||
// References and unreferences the buffer.
|
/**
|
||||||
|
* Reference the buffer.
|
||||||
|
*/
|
||||||
void wlr_buffer_ref(struct wlr_buffer *buffer);
|
void wlr_buffer_ref(struct wlr_buffer *buffer);
|
||||||
|
/**
|
||||||
|
* Unreference the buffer. After this call, `buffer` may not be accessed
|
||||||
|
* anymore.
|
||||||
|
*/
|
||||||
void wlr_buffer_unref(struct wlr_buffer *buffer);
|
void wlr_buffer_unref(struct wlr_buffer *buffer);
|
||||||
// Tries to update the texture in the provided buffer. This destroys `buffer`
|
/**
|
||||||
// and returns a new buffer.
|
* Try to update the buffer's content. On success, returns the updated buffer
|
||||||
// Fails if `buffer->n_refs` > 1 or if the texture isn't mutable.
|
* and destroys the provided `buffer`. On error, `buffer` is intact and NULL is
|
||||||
|
* returned.
|
||||||
|
*
|
||||||
|
* Fails if there's more than one reference to the buffer or if the texture
|
||||||
|
* isn't mutable.
|
||||||
|
*/
|
||||||
struct wlr_buffer *wlr_buffer_apply_damage(struct wlr_buffer *buffer,
|
struct wlr_buffer *wlr_buffer_apply_damage(struct wlr_buffer *buffer,
|
||||||
struct wl_resource *resource, pixman_region32_t *damage);
|
struct wl_resource *resource, pixman_region32_t *damage);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue