scaled_scene_buffer: make dropping the buffer optional

In preparation to also use the scaled_scene_buffer for
theme components like rounded corner images and button
icons.

No functional change intended.
This commit is contained in:
Consolatis 2023-10-14 22:26:40 +02:00 committed by Johan Malm
parent 7aa540b8ab
commit 8d17ab2d60
4 changed files with 51 additions and 10 deletions

View file

@ -30,10 +30,12 @@ static void
_destroy(struct scaled_scene_buffer *scaled_buffer)
{
struct scaled_font_buffer *self = scaled_buffer->data;
scaled_buffer->data = NULL;
zfree(self->text);
zfree(self->font.name);
zfree(self->arrow);
zfree(scaled_buffer->data);
free(self);
}
static const struct scaled_scene_buffer_impl impl = {
@ -48,7 +50,7 @@ scaled_font_buffer_create(struct wlr_scene_tree *parent)
assert(parent);
struct scaled_font_buffer *self = znew(*self);
struct scaled_scene_buffer *scaled_buffer =
scaled_scene_buffer_create(parent, &impl);
scaled_scene_buffer_create(parent, &impl, /* drop_buffer */ true);
if (!scaled_buffer) {
free(self);
return NULL;