summaryrefslogtreecommitdiff
path: root/core/Core.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Core.zig')
-rw-r--r--core/Core.zig15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/Core.zig b/core/Core.zig
index e718149e..61d8c7e9 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -1399,7 +1399,8 @@ fn refillPendingWrites(p: *Pardes) void {
/// may be handed to a different pane next frame.
pub fn dropPendingWrite(p: *Pardes, id: usize) void {
const pw = p.pending_write[id] orelse return;
- p.pending_write_bytes -= pw.bytes.len - pw.off;
+ // (Saturating: a damaged image's total may say less than its parts.)
+ p.pending_write_bytes -|= pw.bytes.len - pw.off;
p.gpa.free(pw.bytes);
p.pending_write[id] = null;
}
@@ -2303,7 +2304,17 @@ pub fn appendPlacement(p: *Pardes, place: Placement) bool {
return true;
}
-pub const PendingWrite = struct { bytes: []u8, off: usize = 0 };
+pub const PendingWrite = struct {
+ /// What is written held to the bytes (walk.zig `.place`): a damaged
+ /// image's past them freed a count below zero.
+ pub const replica = .{ .place = .{.{ "off", "lastOff" }} };
+ bytes: []u8,
+ off: usize = 0,
+
+ pub fn lastOff(pw: *const PendingWrite) usize {
+ return pw.bytes.len;
+ }
+};
/// The session layouts `init` can put on screen. One name each, so choosing
/// between them reads as a choice instead of a chain of ifs over four options.