From 3e1677f526baa02179c5646223f48b316e5152e0 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 18:31:03 -0300 Subject: kinds #40, rasters as bounded messages on the wire (ยง17.3 C): a placement over PA_RASTER_MAX is dropped at paint and said once, a kind's frame names its placements by key and their pixels cross before it as `raster` strips of at most 4 MiB over the rows its `src` shows (only those the peer was not sent with the frame before), the peer assembles them by name in a 64 MiB cache let go by least recent use but for what a Shadow shows, a frame naming one it lacks draws its cells and asks once for its pane again, the sender checks every message against wire.max_payload (Debug's panic, release's drop and log) and a reader names an oversized one (said on the client as it joins again, logged at the session) instead of reading it as the link's end, so kinds #21's byte budget goes; wire 23; and pdf.c lays out for a view with pictures over a glyph view until an input chooses (one layout until 7c), so the 110-column window of the stall's repro shows its page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Kind.zig | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/Kind.zig') diff --git a/src/Kind.zig b/src/Kind.zig index 71ff4890..db3bee49 100644 --- a/src/Kind.zig +++ b/src/Kind.zig @@ -392,11 +392,6 @@ pub fn draw(p: *Pardes, s: *surface.Surface, arena: std.mem.Allocator, pane: *Pa }; for (frame.places[0..frame.n]) |pl| { if (pl.rgba == null or pl.w == 0 or pl.h == 0) continue; - if (@as(u64, pl.w) * pl.h * 4 > c.PA_RASTER_MAX) { - if (slot.over & 1 << 31 == 0) std.log.warn("{s}: a picture of {d} MB, over {d} MiB", .{ slot.nameOf(), @as(u64, pl.w) * pl.h * 4 >> 20, c.PA_RASTER_MAX >> 20 }); - slot.over |= 1 << 31; - continue; - } const dx = @min(pl.dst.x, cols); const dy = @min(pl.dst.y, rows); _ = p.appendPlacement(.{ @@ -439,7 +434,17 @@ pub fn paint(p: *const Pardes, slot: *Slot, id: usize, arena: std.mem.Allocator, if (checked and usedHash(slot) != before) std.debug.panic("addon {s}: paint changed its state (paint must be pure)", .{slot.nameOf()}); _ = cl.end(prev); frame.places = &frame.buf; - frame.n = @min(out.n, frame.buf.len); + // A picture over the bound is dropped, said once a pane (17.3). + frame.n = 0; + for (frame.buf[0..@min(out.n, frame.buf.len)]) |pl| { + if (@as(u64, pl.w) * pl.h * 4 > c.PA_RASTER_MAX) { + if (slot.over & 1 << 31 == 0) std.log.warn("{s}: a picture of {d} MB, over {d} MiB", .{ slot.nameOf(), @as(u64, pl.w) * pl.h * 4 >> 20, c.PA_RASTER_MAX >> 20 }); + slot.over |= 1 << 31; + continue; + } + frame.buf[frame.n] = pl; + frame.n += 1; + } slot.thumb_at = std.math.clamp(out.at, 0, 1); slot.thumb_span = std.math.clamp(out.span, 0, 1); slot.pointer = @intCast(@min(out.pointer, 255)); -- cgit v1.3