From 0a2694e935fa8a79f1a399f2d2cbc643f8c3734e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 08:28:40 -0300 Subject: G13: Parallax, lapis's dots drift with the text at a quarter of its speed Parallax on|off (off, a pixel shell's; Chrome.fx bit 3). A body region carries its first line (Region.line, a file's scroll or a terminal's grid offset; the wire's region record grows a u32). The GUI offsets each body's page dots by a quarter of its line in rows, and of G6's glide offset while one runs, so the pattern drifts with the text and settles with it; the cell shader reads it from the instance's serial slot, whose per-cell dissolve noise G7 left unused (the dead noise code goes). Tests: a scrolled body tells its line; the shift handed to the shader is a quarter of it within the dots' period. Measured in a capture: four lines move the dots 13 px (140 px / 4 mod 22). Gates as before, goldens byte-identical. Feel review: .scratch/render/parallax/. --- src/draw.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/draw.zig') diff --git a/src/draw.zig b/src/draw.zig index 027326fa..aef93f51 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -63,7 +63,8 @@ pub fn place(p: *Pardes, s: *Surface) void { // A folded pane is its tag rows and nothing else. if (pane.collapsed) continue; const body_h = r.h -| pane.tag_rows; - s.addRegion(.{ .kind = .body, .owner = owner, .serial = pane.serial, .active = active, .rect = .{ .x = r.x + config.GUTTER, .y = body_y, .w = r.w - config.GUTTER, .h = body_h } }); + const line: i32 = if (pane.file) |f| @intCast(@min(f.scroll, std.math.maxInt(i32))) else if (pane.isTerminal()) panes.Terminal.gridOffset(pane) else 0; + s.addRegion(.{ .kind = .body, .owner = owner, .serial = pane.serial, .active = active, .line = line, .rect = .{ .x = r.x + config.GUTTER, .y = body_y, .w = r.w - config.GUTTER, .h = body_h } }); var rail: Region = .{ .kind = .rail, .owner = owner, .serial = pane.serial, .active = active, .rect = .{ .x = r.x, .y = body_y, .w = config.GUTTER, .h = body_h } }; // An image's rail has no thumb; a native PDF's is measured as its // pages are placed (Pdf.draw); every other pane's is here. @@ -472,7 +473,7 @@ pub fn render(p: *Pardes, arena: std.mem.Allocator) !*Surface { .rail_px = @intCast(@min(255, @as(u32, p.theme().rail_px orelse 12) * p.settings.grip_width / 100)), .name_ink = chrome.tag_name_fg, .active_name_ink = if (p.settings.focus_tint) chrome.tag_active_name_fg else chrome.tag_name_fg, - .fx = @as(u8, @intFromBool(p.settings.selection_glow)) | @as(u8, @intFromBool(p.settings.hover_glow)) << 1 | @as(u8, @intFromBool(p.settings.occlusion)) << 2, + .fx = @as(u8, @intFromBool(p.settings.selection_glow)) | @as(u8, @intFromBool(p.settings.hover_glow)) << 1 | @as(u8, @intFromBool(p.settings.occlusion)) << 2 | @as(u8, @intFromBool(p.settings.parallax)) << 3, }; if (p.theme().decor) |decor| { s.chrome.decor_dots = decor.page_dots; -- cgit v1.3