diff options
Diffstat (limited to 'anim/src/context.zig')
| -rw-r--r-- | anim/src/context.zig | 8 |
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; |
