summaryrefslogtreecommitdiff
path: root/src/gui/Post.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/Post.zig')
-rw-r--r--src/gui/Post.zig10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/gui/Post.zig b/src/gui/Post.zig
index 64a431b9..19b10c52 100644
--- a/src/gui/Post.zig
+++ b/src/gui/Post.zig
@@ -2,8 +2,8 @@
//! finished frame, each reading the one before it (the frame first) and the
//! last one writing the window. A pass is the bundled Crt (shaders/post/,
//! compiled with the build) or a user's file (Shader <path>), whose SPIR-V
-//! comes from ShaderBuild.zig: compiled by the process that holds the core,
-//! this one or the detached session this GUI is attached to. A file whose
+//! comes from ShaderBuild.zig, compiled by this process (a window attached
+//! to a session elsewhere runs the bundled passes alone). A file whose
//! compile fails keeps its last good pipeline.
//!
//! The uniforms are ghostty's (Uniforms), so a shader written for ghostty runs
@@ -289,7 +289,6 @@ fn unit(rgb: [3]u8) [3]f32 {
pub fn capsOf(frame: Frame) std.EnumArray(Scene, f32) {
const pairs = [_][2][3]f32{ .{ unit(frame.foreground), unit(frame.background) }, .{ unit(frame.selection_foreground), unit(frame.selection_background) } };
var bloom: f32 = 1;
- var shade: f32 = 1;
for (pairs) |pair| {
const a = luminance(pair[0]);
const b = luminance(pair[1]);
@@ -298,10 +297,9 @@ pub fn capsOf(frame: Frame) std.EnumArray(Scene, f32) {
const target = @min(contrastOf(a, b), 4.5);
// (light + e + .05) / (dark + e + .05) >= target
bloom = @min(bloom, @max(0, (light + 0.05 - target * (dark + 0.05)) / @max(target - 1, 1e-3)));
- // (k light + .05) / (k dark + .05) >= target, darkened by 1 - k
- const room = light - target * dark;
- shade = @min(shade, if (room <= 0) 0 else std.math.clamp(1 - 0.05 * (target - 1) / room, 0, 1));
}
+ // A vignette darkens both of a pair as a lift's shadow does.
+ const shade = @min(gui.shadowCeiling(frame.foreground, frame.background), gui.shadowCeiling(frame.selection_foreground, frame.selection_background));
// Grain: the largest step off the page, up and down, that keeps the text
// on it at its contrast or 4.5 (searched in 1/1020 steps up to 8/255).
const ink = luminance(unit(frame.foreground));