mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-06-13 14:32:57 -04:00
Merge branch 'tex-signals' into 'master'
render/texture: Emit signals on destroy and update See merge request wlroots/wlroots!5351
This commit is contained in:
commit
801a1b8b63
2 changed files with 21 additions and 1 deletions
|
|
@ -24,6 +24,11 @@ struct wlr_texture {
|
||||||
uint32_t width, height;
|
uint32_t width, height;
|
||||||
|
|
||||||
struct wlr_renderer *renderer;
|
struct wlr_renderer *renderer;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wl_signal destroy;
|
||||||
|
struct wl_signal updated;
|
||||||
|
} events;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_texture_read_pixels_options {
|
struct wlr_texture_read_pixels_options {
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,17 @@ void wlr_texture_init(struct wlr_texture *texture, struct wlr_renderer *renderer
|
||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
wl_signal_init(&texture->events.destroy);
|
||||||
|
wl_signal_init(&texture->events.updated);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_texture_destroy(struct wlr_texture *texture) {
|
void wlr_texture_destroy(struct wlr_texture *texture) {
|
||||||
|
wl_signal_emit(&texture->events.destroy, NULL);
|
||||||
|
|
||||||
|
assert(wl_list_empty(&texture->events.destroy.listener_list));
|
||||||
|
assert(wl_list_empty(&texture->events.updated.listener_list));
|
||||||
|
|
||||||
if (texture && texture->impl && texture->impl->destroy) {
|
if (texture && texture->impl && texture->impl->destroy) {
|
||||||
texture->impl->destroy(texture);
|
texture->impl->destroy(texture);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -133,5 +141,12 @@ bool wlr_texture_update_from_buffer(struct wlr_texture *texture,
|
||||||
extents->y2 > buffer->height) {
|
extents->y2 > buffer->height) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return texture->impl->update_from_buffer(texture, buffer, damage);
|
|
||||||
|
bool ret = texture->impl->update_from_buffer(texture, buffer, damage);
|
||||||
|
if (!ret) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wl_signal_emit (&texture->events.updated, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue