summaryrefslogtreecommitdiff
path: root/src/macos.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 00:22:27 -0300
committerGabriel Schneider <[email protected]>2026-11-05 01:00:59 -0300
commit1b12f7aadaf0e0a4570a5985900f61d0fb897f79 (patch)
tree2563f00aa47d3ef39ef1647482ba5d19bc1373a1 /src/macos.zig
parentb283824eed0703ae9b89f2af520354046146b855 (diff)
downloadpardes-1b12f7aadaf0e0a4570a5985900f61d0fb897f79.tar.gz
pardes-1b12f7aadaf0e0a4570a5985900f61d0fb897f79.zip
surface: a frame's images are a std.ArrayList(ImagePlace), where they were a slice of optionals grown by hand (appendImagePlace's doubling realloc, nimages beside it) whose slots were never null: every reader's `orelse continue` and `.?` go (gui, tui, terminal, TerminalImages, ninep/screen, test/pdf.zig, kitty and the two PDF benches); macos.zig's loop the same, passing ast-check but not built here
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/macos.zig')
-rw-r--r--src/macos.zig11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/macos.zig b/src/macos.zig
index bc906dea..e69a2fbe 100644
--- a/src/macos.zig
+++ b/src/macos.zig
@@ -1756,16 +1756,15 @@ fn encodeChanged(diff: pardes.PanelCellDiff) u8 {
fn collectImages(st: *State, surface: *const pardes.Surface) void {
if (comptime !pardes.pdf_enabled) return;
- if (surface.nimages == 0) return;
- if (st.images.len < surface.nimages) {
+ if (surface.images.items.len == 0) return;
+ if (st.images.len < surface.images.items.len) {
const resized = if (st.images.len == 0)
- st.gpa.alloc(Image, surface.nimages)
+ st.gpa.alloc(Image, surface.images.items.len)
else
- st.gpa.realloc(st.images, surface.nimages);
+ st.gpa.realloc(st.images, surface.images.items.len);
st.images = resized catch return;
}
- for (surface.images[0..surface.nimages]) |maybe| {
- const place = maybe orelse continue;
+ for (surface.images.items) |place| {
if (place.iw == 0 or place.ih == 0 or place.rgba.len == 0) continue;
const geometry = place.native.geometry orelse image.NativeGeometry{
.src = .{ .x = 0, .y = 0, .w = @intCast(place.iw), .h = @intCast(place.ih) },