summaryrefslogtreecommitdiff
path: root/src/Kind.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-09 02:04:25 -0300
committerGabriel Schneider <[email protected]>2026-11-09 02:14:10 -0300
commitc78d362fa20393621ac198861f891439f9d832e9 (patch)
tree7ba6d82f7dca1926abf7a985cf3830c69d21c90c /src/Kind.zig
parent69b993d585cfb14c607f46aba500b141b85516ff (diff)
downloadpardes-c78d362fa20393621ac198861f891439f9d832e9.tar.gz
pardes-c78d362fa20393621ac198861f891439f9d832e9.zip
locality: caller-led moves: MAX_JUMPS into Jump.zig (Core's unused alias goes), RasterPolicy and rasterPolicy beside Kind.viewOf, Names.relative beside Query.startSource, fs.find_skip beside Stream's max_walk_depth, File.drawGutter and drawWrapMarkers beside body_layer.renderBody; each unit's only users are in its new file
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Kind.zig')
-rw-r--r--src/Kind.zig12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Kind.zig b/src/Kind.zig
index bdbfeb2e..806e9558 100644
--- a/src/Kind.zig
+++ b/src/Kind.zig
@@ -677,6 +677,16 @@ fn seen(v: *const c.pa_view) u64 {
return if (v.cols == 0) 0 else std.hash.Wyhash.hash(0, std.mem.asBytes(v));
}
+/// The raster a frontend wants a kind's picture at (Kind.viewOf, a
+/// `pa_view`): a terminal's kitty images go down a wire, so smaller; a
+/// window rasterizes for its display.
+const RasterPolicy = struct { dpi: u16, max_dimension: u16, match_viewport: bool };
+/// A view's: a window's denser than a terminal's. By the view's frontend,
+/// never the build's, so every core of a session asks a kind alike.
+fn rasterPolicy(windowed: bool) RasterPolicy {
+ return if (windowed) .{ .dpi = 192, .max_dimension = 4096, .match_viewport = true } else .{ .dpi = 96, .max_dimension = 1200, .match_viewport = false };
+}
+
/// Pane `id` as view `k` shows it (its id k + 1): its body below its
/// notices, as draw.zig paints it, a cell's pixels, the theme's colours and
/// the raster that view's frontend wants a picture at; no cells when the
@@ -696,7 +706,7 @@ pub fn viewOf(p: *const Pardes, k: u8, id: usize) c.pa_view {
return @as(u32, x[0]) << 16 | @as(u32, x[1]) << 8 | x[2];
}
}.f;
- const policy = pardes.rasterPolicy(v.frontend.windowed);
+ const policy = rasterPolicy(v.frontend.windowed);
return .{
.cols = r.w -| pardes.config.GUTTER,
.rows = (r.h -| tag_rows) -| notices,