summaryrefslogtreecommitdiff
path: root/anim/src/calls.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 16:05:20 -0300
committerGabriel Schneider <[email protected]>2026-11-10 16:43:58 -0300
commit165bb6c1344b98de7bef1d3c2b72147b4a40797a (patch)
tree0e70e6222700063f604f78673f6ab3a5bfb9242d /anim/src/calls.zig
parent66a2a7cf733f6abc1f79561c52d901ce67019fb1 (diff)
downloadcomputeranim-165bb6c1344b98de7bef1d3c2b72147b4a40797a.tar.gz
computeranim-165bb6c1344b98de7bef1d3c2b72147b4a40797a.zip
canim: the renderer speaks the design language
The blocks, their states and the tokens carry the catalogue's names: atoms in ui, chain/reg/slot in rows, insn with its line column, jump lane and annotations (read, write, taken or not, a call with its arguments, a return, a syscall) in disasm, bytes and hexdump with field paper and the reading column, the three splits and relayout in stage, the ties (thread, link and pin, projection, echo). A lens is a band over the whole context, its drawing left and its bytes right. Frames' spans on the stack, each instruction's line and a callee's parameter count come from the tracer. A gallery scene draws every block; the test compares six of its pages with pictures kept in test/gallery, drawn from a recording kept there too. The scenes are ported; the motion checks report no pop and no metronome in any of them. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Diffstat (limited to 'anim/src/calls.zig')
-rw-r--r--anim/src/calls.zig12
1 files changed, 8 insertions, 4 deletions
diff --git a/anim/src/calls.zig b/anim/src/calls.zig
index af0893d..88bca71 100644
--- a/anim/src/calls.zig
+++ b/anim/src/calls.zig
@@ -11,6 +11,8 @@ const ui = @import("ui.zig");
const cursors = @import("cursor.zig");
const Cursor = cursors.Cursor;
const Recording = @import("Recording.zig");
+const context = @import("context.zig");
+const Stage = @import("stage.zig").Stage;
const theme = ui.theme;
const time = theme.time;
const Rect = ui.Rect;
@@ -22,13 +24,15 @@ const badge_after = 0.20;
pub const Tree = struct {
cursor: Cursor,
- box: Rect,
+ stage: *const Stage,
/// The function whose calls are the tree.
function: []const u8,
focus: bool = false,
pub fn draw(k: *const Tree, f: *sk.Frame, at: anim.Placed) void {
- const u: ui.Ui = .{ .f = f, .at = at };
+ const box = k.stage.box(at, .band);
+ if (box.h < theme.metric.context.tag + 24) return;
+ const u = context.at(f, at, box);
const now = k.cursor.now(at);
const rec = k.cursor.rec;
const m = struct {
@@ -36,7 +40,7 @@ pub const Tree = struct {
const level = 44;
const badge = 24;
};
- const body = u.panel(k.box.w, k.box.h, u.print("calls of {s}", .{k.function}), .{ .focus = k.focus, .note = "each call a node \u{00b7} its result on the shoulder \u{00b7} the frames are the stack's" });
+ const body = u.panel(box.w, box.h, u.print("calls of {s}", .{k.function}), .{ .focus = k.focus, .note = "each call a node \u{00b7} its result on the shoulder \u{00b7} the frames are the stack's" });
const nodes = layout(f.scratch, rec, k.function) catch return;
if (nodes.len == 0) return;
var leaves: f32 = 0;
@@ -95,7 +99,7 @@ pub const Tree = struct {
// Done: what it returned, on its shoulder; struck as it lands.
const badge: Rect = .{ .x = cx + 10, .y = cy - m.radius - 12, .w = m.badge, .h = m.badge };
const heat: ui.Heat = if (n.call.exit.? > now.stops[1]) now.heat(0, null, since - badge_after) else .none;
- const ink = u.written(badge, heat, theme.color.page);
+ const ink = u.cellWritten(badge, heat, theme.color.page);
if (heat.level < 1) u.frame(badge, t.faint, theme.stroke.rule);
u.label(ink.face, size, badge, .center, u.print("{d}", .{@as(i64, @bitCast(n.call.result))}), if (heat.level >= 1) ink.ink else ui.rgb(t.primary));
}