summaryrefslogtreecommitdiff
path: root/anim/src/context.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-11 13:22:07 -0300
committerGabriel Schneider <[email protected]>2026-11-11 13:26:44 -0300
commit2f27fbe0aa2da0f85d599c1e5f3ac14d025f590c (patch)
tree140a291011e453888ed87b7a43d75f538abb9fae /anim/src/context.zig
parent576a78b4de02c4c6566c327d85c465554d293975 (diff)
downloadcomputeranim-2f27fbe0aa2da0f85d599c1e5f3ac14d025f590c.tar.gz
computeranim-2f27fbe0aa2da0f85d599c1e5f3ac14d025f590c.zip
canim: the graph of a function's blocks
From the user. A blocks lens draws a function's basic blocks as boxes with their offsets and visit counts, loops in their lanes with the turn count, the path's last edges gold, the pc's block gold, and the disassembly as its view; leave and turn carry the mark along an edge, with the compare's flags framed for the edge chosen. On the map the graph takes the disassembly's place with its rows. The layout is a pure function, tested on sort, reverse and libc's open (twelve blocks the run never reached fold into six boxes). The sort scene walks one trip of its inner loop block by block and sprints the middle on the map. Every scene's linear rows carry a rule and a count at each block's head. The stack's panel no longer reads registers from the file on every draw: a frame is 20 ms where it was 57. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/context.zig')
-rw-r--r--anim/src/context.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/anim/src/context.zig b/anim/src/context.zig
index 9829fa7..55ff9d6 100644
--- a/anim/src/context.zig
+++ b/anim/src/context.zig
@@ -44,7 +44,7 @@ pub const legend = blk: {
/// While a `dive` or a `surface` plays (`map.Map`): each working panel's
/// box, and the rect it is drawn into instead, on its way between its
/// window on the map and its place; its tags, rules and lanes how much shown.
-pub const Zoom = struct { box: Rect, to: Rect, chrome: f32 };
+pub const Zoom = struct { box: Rect, to: Rect, chrome: f32, shows: f32 = 1 };
pub var zoomed: [8]?Zoom = @splat(null);
/// How much the thread shows: it fades in (12 f) once a dive has landed, never in a frame.
pub var thread_shows: f32 = 1;
@@ -58,6 +58,7 @@ pub fn at(f: *sk.Frame, placed: anim.Placed, box: Rect) ui.Ui {
const k = zz.to.w / box.w;
p.xf = p.xf.mul(.translate(zz.to.x, zz.to.y)).mul(.scale(k, k)).mul(.translate(-box.x, -box.y));
p.scale *= k;
+ p.pose.opacity *= zz.shows;
// On its way it is opaque, over the panels that set off before it; its tag and rules come in at the end.
const u = (ui.Ui{ .f = f, .at = p }).moved(box.x, box.y);
u.fill(.{ .x = 0, .y = m.tag, .w = box.w, .h = box.h - m.tag }, theme.color.page);
@@ -667,8 +668,9 @@ pub const Stack = struct {
fn watched(now: cursors.Now, slots: usize, age: usize) usize {
const rec = now.rec;
for (age..now.stops.len - 1) |a| {
- const to = (rec.moment(now.stops[a]).regs(rec.tid) catch null) orelse return a;
- const from = (rec.moment(now.stops[a + 1]).regs(rec.tid) catch null) orelse return a;
+ // The index's registers: reading them from the trace was most of a frame's time.
+ const to = rec.registers[@min(now.stops[a], rec.end())];
+ const from = rec.registers[@min(now.stops[a + 1], rec.end())];
if (far(windowAt(now, to, slots, a), windowAt(now, from, slots, a + 1), slots)) return a;
}
return now.stops.len;