diff options
Diffstat (limited to 'anim/src/rows.zig')
| -rw-r--r-- | anim/src/rows.zig | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/anim/src/rows.zig b/anim/src/rows.zig index 03c5898..08f1fb2 100644 --- a/anim/src/rows.zig +++ b/anim/src/rows.zig @@ -59,6 +59,8 @@ pub const Marks = struct { /// How much the hops after the first show: they fade out as the memory /// they read is about to change (`Now.following`). hops: f32 = 1, + /// How many hops at most: a `tied` annotation's register is its first value (`rax 405010`). + most: usize = 6, }; /// `chain` of a memory access narrower than a word: its address, then what @@ -117,7 +119,7 @@ pub fn chain(u: ui.Ui, x: f32, y: f32, moment: Recording.Moment, value: u64, roo const mid = y + row_h / 2; var hops: Hops = .{}; var at = x; - for (links, 0..) |link, i| { + for (links[0..@min(links.len, marks.most)], 0..) |link, i| { const pointer = link.region != .none; const shown = ui.Value.of(link.value, pointer); const w = shown.width(); @@ -278,7 +280,7 @@ fn ripFlag(u: ui.Ui, x: f32, y: f32, flag: Flag, set: bool) void { } /// A slot's role as it was before the step, and how far (0 to 1) the role it has now has come in over it. -pub const Role = struct { name: []const u8, local: bool = false, going: f32 = 1, from_rsp: ?i64 = null }; +pub const Role = struct { name: []const u8, local: bool = false, going: f32 = 1, from_rsp: ?i64 = null, offset_going: ?f32 = null }; /// `slot`: a word of the stack: a lane to 112 for `row` pins (`pins`, the /// registers that hold its address); its offset from rsp (`from_rsp` @@ -292,9 +294,9 @@ pub fn slot(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, addr: u64, from_ const s = theme.metric.slot; 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.going < 1) { - offset(u.faded(1 - o.going), y, old); - offset(u.faded(o.going), y, from_rsp); + 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); var lead = marks; lead.first = .none; @@ -333,10 +335,14 @@ fn offset(u: ui.Ui, y: f32, from_rsp: i64) void { /// `slot` `free`: a word above rsp the stack has not reached, shown while /// the window is held for the camera: its offset, its address at 60%, its /// word faint, no chain, no pin. -pub fn free(u: ui.Ui, y: f32, moment: Recording.Moment, addr: u64, from_rsp: i64, lead: usize) void { +pub fn free(u: ui.Ui, y: f32, moment: Recording.Moment, addr: u64, from_rsp: i64, lead: usize, was: ?Role) void { const s = theme.metric.slot; const base = baseline(y); - offset(u, y, from_rsp); + // 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); 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); |
