diff options
Diffstat (limited to 'anim/src/rows.zig')
| -rw-r--r-- | anim/src/rows.zig | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/anim/src/rows.zig b/anim/src/rows.zig index 3d0c75c..aaa6b00 100644 --- a/anim/src/rows.zig +++ b/anim/src/rows.zig @@ -364,9 +364,9 @@ pub fn slot(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, addr: u64, from_ if (pins.len > 0 and pin_shows > 0) u.faded(pin_shows).pinRow(s.lane, y, pins, theme.color.region.stack); // An offset that changes with rsp (the window held, or moved by more than the slide) crossfades as a role does. if (was) |o| if (o.from_rsp) |old| if (old != from_rsp and (o.offset_going orelse o.going) < 1) { - offset(u.faded(1 - (o.offset_going orelse o.going)), y, old); - offset(u.faded(o.offset_going orelse o.going), y, from_rsp); - } else offset(u, y, from_rsp) else offset(u, y, from_rsp) else offset(u, y, from_rsp); + offset(u.faded(1 - (o.offset_going orelse o.going)), y, addr, old); + offset(u.faded(o.offset_going orelse o.going), y, addr, from_rsp); + } else offset(u, y, addr, from_rsp) else offset(u, y, addr, from_rsp) else offset(u, y, addr, from_rsp); var lead = marks; lead.first = .none; const base = baseline(y); @@ -406,10 +406,13 @@ pub fn hexMark(n: u64) []const u8 { } /// A slot's offset from rsp, `from_rsp` bytes: hex, faint, ranged right to 172. -fn offset(u: ui.Ui, y: f32, from_rsp: i64) void { - const p = hexMark(@abs(from_rsp)); - const text = if (from_rsp < 0) u.print("-{s}{x}", .{ p, @as(u64, @intCast(-from_rsp)) }) else u.print("+{s}{x}", .{ p, @as(u64, @intCast(from_rsp)) }); - u.text(.mono, size, theme.metric.slot.offset - u.width(.mono, size, text), baseline(y), text, t.faint); +fn offset(u: ui.Ui, y: f32, addr: u64, from_rsp: i64) void { + const magnitude = @abs(from_rsp); + const text = u.print("{s}{s}{x}", .{ if (from_rsp < 0) "-" else "+", hexMark(magnitude), magnitude }); + const width = u.width(.mono, size, text); + const x = theme.metric.slot.offset - width; + u.text(.mono, size, x, baseline(y), text, t.faint); + u.hitAddress(addr, .{ .x = x, .y = y, .w = width, .h = row_h }); } /// `slot` `free`: a word above rsp the stack has not reached, shown while @@ -420,9 +423,9 @@ pub fn free(u: ui.Ui, y: f32, moment: Recording.Moment, addr: u64, from_rsp: i64 const base = baseline(y); // An offset whose base the step moves crossfades, as a slot's does. if (was) |o| if (o.from_rsp) |old| if (old != from_rsp and o.going < 1) { - offset(u.faded(1 - o.going), y, old); - offset(u.faded(o.going), y, from_rsp); - } else offset(u, y, from_rsp) else offset(u, y, from_rsp) else offset(u, y, from_rsp); + offset(u.faded(1 - o.going), y, addr, old); + offset(u.faded(o.going), y, addr, from_rsp); + } else offset(u, y, addr, from_rsp) else offset(u, y, addr, from_rsp) else offset(u, y, addr, from_rsp); const end = u.address(s.address, base, addr, .{ .ink = ui.mix(theme.color.region.stack, theme.color.page, theme.metric.context.lead_alpha), .lead = lead }); const word = (Recording.word(moment, addr, 8) catch null) orelse return u.unknown(.{ .x = end + m.arrow_w, .y = y, .w = 24, .h = row_h }); u.text(.mono, size, end + m.arrow_w, base, u.print("{x}", .{word}), t.faint); @@ -544,6 +547,7 @@ pub const Run = struct { first: u8, len: u8, kind: enum { number, pointer, text, loose, unread }, + background: bool = true, /// Its mark: struck (heat), read (shows), held is in the heat. heat: ui.Heat = .none, read: f32 = 0, @@ -587,7 +591,7 @@ pub fn bytesAt(at: ui.Ui, y: f32, addr: u64, values: *const [16]u8, known: *cons const x1 = byteX(run.first + run.len - 1) + 28; const r: Rect = .{ .x = x0, .y = y + 1, .w = x1 - x0, .h = row_h - 2 }; const field = run.kind == .number or run.kind == .pointer or run.kind == .text; - if (field) u.fill(r, theme.color.raised); + if (field and run.background) u.fill(r, theme.color.raised); // Read is per run (a frame 3 out). A write's marks cover the bytes // whose value changed, first to last (`changed`): armed, then struck // a byte a frame from the low address (the softened paper, the |
