summaryrefslogtreecommitdiff
path: root/src/Kind.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 18:31:03 -0300
committerGabriel Schneider <[email protected]>2026-11-06 20:00:43 -0300
commit3e1677f526baa02179c5646223f48b316e5152e0 (patch)
tree2ac232f703a0c2f17abc0f07db4161660c0c2544 /src/Kind.zig
parent1b38ca0aa0bfae1177f80a6713ec6d787d2f77d4 (diff)
downloadpardes-3e1677f526baa02179c5646223f48b316e5152e0.tar.gz
pardes-3e1677f526baa02179c5646223f48b316e5152e0.zip
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
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Kind.zig')
-rw-r--r--src/Kind.zig17
1 files changed, 11 insertions, 6 deletions
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));