summaryrefslogtreecommitdiff
path: root/src/pardes.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/pardes.zig')
-rw-r--r--src/pardes.zig16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index 11cb762a..fb26840b 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -4478,7 +4478,7 @@ pub const Pardes = struct {
for (&p.surface.body_layers) |*layer| gpa.free(layer.cells);
for (&p.surface.tag_layers) |*layer| gpa.free(layer.cells);
p.presentation.deinit(gpa);
- if (p.surface.images.len > 0) gpa.free(p.surface.images);
+ p.surface.images.deinit(gpa);
gpa.destroy(p);
}
@@ -7573,19 +7573,7 @@ pub const Pardes = struct {
pub const render = draw.render;
pub fn appendImagePlace(p: *Pardes, place: ImagePlace) bool {
- const s = &p.surface;
- if (s.nimages == s.images.len) {
- const old_len = s.images.len;
- const new_len = @max(@as(usize, 4), std.math.mul(usize, @max(old_len, 1), 2) catch return false);
- const grown = if (old_len == 0)
- p.gpa.alloc(?ImagePlace, new_len) catch return false
- else
- p.gpa.realloc(s.images, new_len) catch return false;
- @memset(grown[old_len..], null);
- s.images = grown;
- }
- s.images[s.nimages] = place;
- s.nimages += 1;
+ p.surface.images.append(p.gpa, place) catch return false;
return true;
}
};