mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-19 06:59:48 -05:00
surface: make wlr_surface.buffer a wlr_buffer
This commit is contained in:
parent
0467a7523a
commit
486a481612
2 changed files with 14 additions and 15 deletions
|
|
@ -92,7 +92,7 @@ struct wlr_surface {
|
||||||
* have a buffer if it has never committed one, has committed a null buffer,
|
* have a buffer if it has never committed one, has committed a null buffer,
|
||||||
* or something went wrong with uploading the buffer.
|
* or something went wrong with uploading the buffer.
|
||||||
*/
|
*/
|
||||||
struct wlr_client_buffer *buffer;
|
struct wlr_buffer *buffer;
|
||||||
/**
|
/**
|
||||||
* The buffer position, in surface-local units.
|
* The buffer position, in surface-local units.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -353,19 +353,19 @@ static void surface_apply_damage(struct wlr_surface *surface) {
|
||||||
struct wl_resource *resource = surface->current.buffer_resource;
|
struct wl_resource *resource = surface->current.buffer_resource;
|
||||||
if (resource == NULL) {
|
if (resource == NULL) {
|
||||||
// NULL commit
|
// NULL commit
|
||||||
if (surface->buffer != NULL) {
|
wlr_buffer_unlock(surface->buffer);
|
||||||
wlr_buffer_unlock(&surface->buffer->base);
|
|
||||||
}
|
|
||||||
surface->buffer = NULL;
|
surface->buffer = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface->buffer != NULL && surface->buffer->resource_released) {
|
struct wlr_client_buffer *client_buffer = surface->buffer != NULL ?
|
||||||
|
wlr_client_buffer_get(surface->buffer) : NULL;
|
||||||
|
if (client_buffer != NULL && client_buffer->resource_released) {
|
||||||
struct wlr_client_buffer *updated_buffer =
|
struct wlr_client_buffer *updated_buffer =
|
||||||
wlr_client_buffer_apply_damage(surface->buffer, resource,
|
wlr_client_buffer_apply_damage(client_buffer, resource,
|
||||||
&surface->buffer_damage);
|
&surface->buffer_damage);
|
||||||
if (updated_buffer != NULL) {
|
if (updated_buffer != NULL) {
|
||||||
surface->buffer = updated_buffer;
|
surface->buffer = &updated_buffer->base;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -377,10 +377,8 @@ static void surface_apply_damage(struct wlr_surface *surface) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface->buffer != NULL) {
|
wlr_buffer_unlock(surface->buffer);
|
||||||
wlr_buffer_unlock(&surface->buffer->base);
|
surface->buffer = &buffer->base;
|
||||||
}
|
|
||||||
surface->buffer = buffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void surface_update_opaque_region(struct wlr_surface *surface) {
|
static void surface_update_opaque_region(struct wlr_surface *surface) {
|
||||||
|
|
@ -707,9 +705,7 @@ static void surface_handle_resource_destroy(struct wl_resource *resource) {
|
||||||
pixman_region32_fini(&surface->buffer_damage);
|
pixman_region32_fini(&surface->buffer_damage);
|
||||||
pixman_region32_fini(&surface->opaque_region);
|
pixman_region32_fini(&surface->opaque_region);
|
||||||
pixman_region32_fini(&surface->input_region);
|
pixman_region32_fini(&surface->input_region);
|
||||||
if (surface->buffer != NULL) {
|
wlr_buffer_unlock(surface->buffer);
|
||||||
wlr_buffer_unlock(&surface->buffer->base);
|
|
||||||
}
|
|
||||||
free(surface);
|
free(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -771,7 +767,10 @@ struct wlr_texture *wlr_surface_get_texture(struct wlr_surface *surface) {
|
||||||
if (surface->buffer == NULL) {
|
if (surface->buffer == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return surface->buffer->texture;
|
struct wlr_client_buffer *client_buffer =
|
||||||
|
wlr_client_buffer_get(surface->buffer);
|
||||||
|
assert(client_buffer);
|
||||||
|
return client_buffer->texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wlr_surface_has_buffer(struct wlr_surface *surface) {
|
bool wlr_surface_has_buffer(struct wlr_surface *surface) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue