mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-22 15:12:26 +00:00
render/pixman: destroy textures on renderer teardown
This commit is contained in:
parent
661ba49564
commit
8ca2b4cf49
@ -17,6 +17,7 @@ struct wlr_pixman_renderer {
|
|||||||
struct wlr_renderer wlr_renderer;
|
struct wlr_renderer wlr_renderer;
|
||||||
|
|
||||||
struct wl_list buffers; // wlr_pixman_buffer.link
|
struct wl_list buffers; // wlr_pixman_buffer.link
|
||||||
|
struct wl_list textures; // wlr_pixman_texture.link
|
||||||
|
|
||||||
struct wlr_pixman_buffer *current_buffer;
|
struct wlr_pixman_buffer *current_buffer;
|
||||||
int32_t width, height;
|
int32_t width, height;
|
||||||
@ -37,6 +38,7 @@ struct wlr_pixman_buffer {
|
|||||||
struct wlr_pixman_texture {
|
struct wlr_pixman_texture {
|
||||||
struct wlr_texture wlr_texture;
|
struct wlr_texture wlr_texture;
|
||||||
struct wlr_pixman_renderer *renderer;
|
struct wlr_pixman_renderer *renderer;
|
||||||
|
struct wl_list link; // wlr_pixman_renderer.textures
|
||||||
|
|
||||||
void *data;
|
void *data;
|
||||||
pixman_image_t *image;
|
pixman_image_t *image;
|
||||||
|
@ -48,6 +48,7 @@ static void texture_destroy(struct wlr_texture *wlr_texture) {
|
|||||||
}
|
}
|
||||||
struct wlr_pixman_texture *texture = get_texture(wlr_texture);
|
struct wlr_pixman_texture *texture = get_texture(wlr_texture);
|
||||||
|
|
||||||
|
wl_list_remove(&texture->link);
|
||||||
pixman_image_unref(texture->image);
|
pixman_image_unref(texture->image);
|
||||||
free(texture->data);
|
free(texture->data);
|
||||||
free(texture);
|
free(texture);
|
||||||
@ -249,7 +250,7 @@ static void pixman_render_quad_with_matrix(struct wlr_renderer *wlr_renderer,
|
|||||||
height, NULL, 0);
|
height, NULL, 0);
|
||||||
|
|
||||||
// TODO find a way to fill the image without allocating 2 images
|
// TODO find a way to fill the image without allocating 2 images
|
||||||
pixman_image_composite32 (PIXMAN_OP_SRC, fill, NULL, image,
|
pixman_image_composite32(PIXMAN_OP_SRC, fill, NULL, image,
|
||||||
0, 0, 0, 0, 0, 0, width, height);
|
0, 0, 0, 0, 0, 0, width, height);
|
||||||
pixman_image_unref(fill);
|
pixman_image_unref(fill);
|
||||||
|
|
||||||
@ -322,6 +323,8 @@ static struct wlr_texture *pixman_texture_from_pixels(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wl_list_insert(&renderer->textures, &texture->link);
|
||||||
|
|
||||||
return &texture->wlr_texture;
|
return &texture->wlr_texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,6 +363,11 @@ static void pixman_destroy(struct wlr_renderer *wlr_renderer) {
|
|||||||
destroy_buffer(buffer);
|
destroy_buffer(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_pixman_texture *tex, *tex_tmp;
|
||||||
|
wl_list_for_each_safe(tex, tex_tmp, &renderer->textures, link) {
|
||||||
|
wlr_texture_destroy(&tex->wlr_texture);
|
||||||
|
}
|
||||||
|
|
||||||
wlr_drm_format_set_finish(&renderer->drm_formats);
|
wlr_drm_format_set_finish(&renderer->drm_formats);
|
||||||
|
|
||||||
free(renderer);
|
free(renderer);
|
||||||
@ -388,6 +396,7 @@ struct wlr_renderer *wlr_pixman_renderer_create(void) {
|
|||||||
wlr_log(WLR_INFO, "Creating pixman renderer");
|
wlr_log(WLR_INFO, "Creating pixman renderer");
|
||||||
wlr_renderer_init(&renderer->wlr_renderer, &renderer_impl);
|
wlr_renderer_init(&renderer->wlr_renderer, &renderer_impl);
|
||||||
wl_list_init(&renderer->buffers);
|
wl_list_init(&renderer->buffers);
|
||||||
|
wl_list_init(&renderer->textures);
|
||||||
|
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
const uint32_t *formats = get_pixman_drm_formats(&len);
|
const uint32_t *formats = get_pixman_drm_formats(&len);
|
||||||
|
Loading…
Reference in New Issue
Block a user