summaryrefslogtreecommitdiff
path: root/src/Kind.zig
diff options
context:
space:
mode:
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,