mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
Introduce wlr_buffer
This commit is contained in:
parent
a072a8309e
commit
e4933ab445
5 changed files with 263 additions and 91 deletions
36
include/wlr/types/wlr_buffer.h
Normal file
36
include/wlr/types/wlr_buffer.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef WLR_TYPES_WLR_BUFFER_H
|
||||
#define WLR_TYPES_WLR_BUFFER_H
|
||||
|
||||
#include <pixman.h>
|
||||
#include <wayland-server.h>
|
||||
|
||||
struct wlr_buffer {
|
||||
struct wl_resource *resource;
|
||||
struct wlr_texture *texture;
|
||||
bool released;
|
||||
size_t n_refs;
|
||||
|
||||
struct wl_listener resource_destroy;
|
||||
};
|
||||
|
||||
struct wlr_renderer;
|
||||
|
||||
// Checks if a resource is a wl_buffer.
|
||||
bool wlr_resource_is_buffer(struct wl_resource *resource);
|
||||
// Returns the buffer size.
|
||||
bool wlr_buffer_get_resource_size(struct wl_resource *resource,
|
||||
struct wlr_renderer *renderer, int *width, int *height);
|
||||
|
||||
// Uploads the texture to the GPU and references it.
|
||||
struct wlr_buffer *wlr_buffer_create(struct wlr_renderer *renderer,
|
||||
struct wl_resource *resource);
|
||||
// References and unreferences the buffer.
|
||||
void wlr_buffer_ref(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.
|
||||
// Fails if `buffer->n_refs` > 1 or if the texture isn't mutable.
|
||||
struct wlr_buffer *wlr_buffer_apply_damage(struct wlr_buffer *buffer,
|
||||
struct wl_resource *resource, pixman_region32_t *damage);
|
||||
|
||||
#endif
|
||||
|
|
@ -69,6 +69,7 @@ struct wlr_subsurface {
|
|||
struct wlr_surface {
|
||||
struct wl_resource *resource;
|
||||
struct wlr_renderer *renderer;
|
||||
struct wlr_buffer *buffer;
|
||||
struct wlr_texture *texture;
|
||||
struct wlr_surface_state *current, *pending;
|
||||
const char *role; // the lifetime-bound role or null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue