summaryrefslogtreecommitdiff
path: root/anim/src/calls.zig
diff options
context:
space:
mode:
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));
}