summaryrefslogtreecommitdiff
path: root/src/gui/gui.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/gui/gui.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/gui/gui.zig')
-rw-r--r--src/gui/gui.zig14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig
index ac32ced4..00491aeb 100644
--- a/src/gui/gui.zig
+++ b/src/gui/gui.zig
@@ -6457,8 +6457,7 @@ fn clearNativeImages(g: *Gui) void {
}
fn surfaceHasNativeKey(surface: *const pardes.Surface, key: pardes.ImageCacheKey) bool {
- for (surface.images[0..surface.nimages]) |maybe| {
- const place = maybe orelse continue;
+ for (surface.images.items) |place| {
if (validImageBytes(place) != null and place.cacheKey().eql(key)) return true;
}
return false;
@@ -6474,9 +6473,8 @@ fn rememberPresentedImages(g: *Gui, gpa: std.mem.Allocator, surface: *const pard
var next: std.ArrayListUnmanaged(SavedImagePlace) = .empty;
var adopted = false;
defer if (!adopted) next.deinit(gpa);
- next.ensureTotalCapacity(gpa, surface.nimages) catch return;
- for (surface.images[0..surface.nimages]) |maybe| {
- const place = maybe orelse continue;
+ next.ensureTotalCapacity(gpa, surface.images.items.len) catch return;
+ for (surface.images.items) |place| {
if (validImageBytes(place) == null or !g.native_images.contains(place.cacheKey())) continue;
next.appendAssumeCapacity(SavedImagePlace.from(place));
}
@@ -6753,8 +6751,7 @@ fn prepareNativeImages(
sw: u32,
sh: u32,
) bool {
- for (surface.images[0..surface.nimages]) |maybe| {
- const place = maybe orelse continue;
+ for (surface.images.items) |place| {
if (validImageBytes(place) == null) continue;
uploadNativeTexture(g, gpa, cmd, place) catch continue;
}
@@ -6794,8 +6791,7 @@ fn prepareNativeImages(
}
if (track == null or track.?.phase != .closing) {
- for (surface.images[0..surface.nimages]) |maybe| {
- const current = maybe orelse continue;
+ for (surface.images.items) |current| {
if (validImageBytes(current) == null or
groupOf(groups, current.serial) != group_index) continue;
const saved = SavedImagePlace.from(current);