diff options
Diffstat (limited to 'src/Kind.zig')
| -rw-r--r-- | src/Kind.zig | 17 |
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)); |
