From ed3e3764d9e39b63eb17ff6cc11eefb985739337 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 15 Nov 2023 11:38:16 -0800 Subject: [PATCH] renderer: faint should not be applied to bg alpha Fixes #889 --- src/renderer/Metal.zig | 12 +++++++----- src/renderer/OpenGL.zig | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/renderer/Metal.zig b/src/renderer/Metal.zig index e3cf2ae9e..ff8620686 100644 --- a/src/renderer/Metal.zig +++ b/src/renderer/Metal.zig @@ -1322,22 +1322,24 @@ pub fn updateCell( // in an attempt to make transparency look the best for various // situations. See inline comments. const bg_alpha: u8 = bg_alpha: { - if (self.config.background_opacity >= 1) break :bg_alpha alpha; + const default: u8 = 255; + + if (self.config.background_opacity >= 1) break :bg_alpha default; // If we're selected, we do not apply background opacity - if (selected) break :bg_alpha alpha; + if (selected) break :bg_alpha default; // If we're reversed, do not apply background opacity - if (cell.attrs.inverse) break :bg_alpha alpha; + if (cell.attrs.inverse) break :bg_alpha default; // If we have a background and its not the default background // then we apply background opacity if (cell.attrs.has_bg and !std.meta.eql(rgb, self.background_color)) { - break :bg_alpha alpha; + break :bg_alpha default; } // We apply background opacity. - var bg_alpha: f64 = @floatFromInt(alpha); + var bg_alpha: f64 = @floatFromInt(default); bg_alpha *= self.config.background_opacity; bg_alpha = @ceil(bg_alpha); break :bg_alpha @intFromFloat(bg_alpha); diff --git a/src/renderer/OpenGL.zig b/src/renderer/OpenGL.zig index c699572c9..1305591bd 100644 --- a/src/renderer/OpenGL.zig +++ b/src/renderer/OpenGL.zig @@ -1084,22 +1084,24 @@ pub fn updateCell( // in an attempt to make transparency look the best for various // situations. See inline comments. const bg_alpha: u8 = bg_alpha: { - if (self.config.background_opacity >= 1) break :bg_alpha alpha; + const default: u8 = 255; + + if (self.config.background_opacity >= 1) break :bg_alpha default; // If we're selected, we do not apply background opacity - if (selected) break :bg_alpha alpha; + if (selected) break :bg_alpha default; // If we're reversed, do not apply background opacity - if (cell.attrs.inverse) break :bg_alpha alpha; + if (cell.attrs.inverse) break :bg_alpha default; // If we have a background and its not the default background // then we apply background opacity if (cell.attrs.has_bg and !std.meta.eql(rgb, self.background_color)) { - break :bg_alpha alpha; + break :bg_alpha default; } // We apply background opacity. - var bg_alpha: f64 = @floatFromInt(alpha); + var bg_alpha: f64 = @floatFromInt(default); bg_alpha *= self.config.background_opacity; bg_alpha = @ceil(bg_alpha); break :bg_alpha @intFromFloat(bg_alpha);