summaryrefslogtreecommitdiff
path: root/anim/src/descent.zig
diff options
context:
space:
mode:
Diffstat (limited to 'anim/src/descent.zig')
-rw-r--r--anim/src/descent.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/anim/src/descent.zig b/anim/src/descent.zig
index d435b59..53d46c5 100644
--- a/anim/src/descent.zig
+++ b/anim/src/descent.zig
@@ -22,6 +22,7 @@ const ties = @import("ties.zig");
const map = @import("map.zig");
const context = @import("context.zig");
const disasm = @import("disasm.zig");
+const graph = @import("graph.zig");
const syscalls = @import("syscalls.zig");
const Stage = @import("stage.zig").Stage;
const theme = ui.theme;
@@ -255,6 +256,8 @@ pub const Descent = struct {
var last_window: ?u8 = null;
const dd: disasm.Disasm = .{ .cursor = d.cursor, .stage = d.stage };
const base: usize = if (going >= 0.5) 0 else 1;
+ // Each window's blocks (`graph`), read once: a rule over each one's first row, its visits where the row has room.
+ var rules: [8]?graph.Rules = @splat(null);
for (placed_items.items) |p| {
const v = u.faded(p.shows);
const y = p.y + p.rise;
@@ -305,7 +308,11 @@ pub const Descent = struct {
}
runs.add(line != null and line.? == current_line, y, y + m.row);
// A row drawn twice (crossfading) counts once for the arguments that hang over the rows under it.
- const hangs = dd.insn(v, now, row, y, box.w, widen0 + wide, line, line != last_line, current_line, lead, state, base, if (p.twin) covered_before > 0 else covered > 0, .{ addrs[0], addrs[n -| 1] }, null);
+ const covers = if (p.twin) covered_before > 0 else covered > 0;
+ const hangs = dd.insn(v, now, row, y, box.w, widen0 + wide, line, line != last_line, current_line, lead, state, base, covers, .{ addrs[0], addrs[n -| 1] }, null);
+ const w = @min(p.item.window, rules.len - 1);
+ if (rules[w] == null) rules[w] = graph.Rules.init(u.f.scratch, rec, now.marks, .{ row.addr, row.addr }, going);
+ rules[w].?.draw(v, row.addr, y, box.w, !covers and !row.outside and !dd.noted(v, now, row, y, state, base, .{ addrs[0], addrs[n -| 1] }, null));
if (!p.twin) covered_before = covered;
covered = if (p.twin) @max(covered, hangs) else @max(covered -| 1, hangs);
last_line = line;