From c778307b0e51a8125d764491cff74bb35bd88e7b Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 26 Jan 2020 18:58:29 -0800 Subject: [PATCH] macos: fix light background/border The opengl based render first clears the window to the background color and then renders the cells over the top. on macOS I noticed a weird lighter strip to the bottom and right of the window and ran it down to the initial clear: our colors are SRGB rather than plain RGB and the discrepancy from rendering SRGB as RGB results in the color being made a brighter shade. This was less noticeable for black backgrounds. --- src/frontend/gui/termwindow.rs | 4 ++-- window/examples/basic_opengl.rs | 2 +- window/src/lib.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/frontend/gui/termwindow.rs b/src/frontend/gui/termwindow.rs index 7359a1db4..1edd59218 100644 --- a/src/frontend/gui/termwindow.rs +++ b/src/frontend/gui/termwindow.rs @@ -444,7 +444,7 @@ impl WindowCallbacks for TermWindow { let tab = match self.get_active_tab_or_overlay() { Some(tab) => tab, None => { - frame.clear_color(0., 0., 0., 1.); + frame.clear_color_srgb(0., 0., 0., 1.); return; } }; @@ -1545,7 +1545,7 @@ impl TermWindow { let background_color = palette.resolve_bg(term::color::ColorAttribute::Default); let (r, g, b, a) = background_color.to_tuple_rgba(); - frame.clear_color(r, g, b, a); + frame.clear_color_srgb(r, g, b, a); let first_line_offset = if self.show_tab_bar { 1 } else { 0 }; diff --git a/window/examples/basic_opengl.rs b/window/examples/basic_opengl.rs index 3e993670d..edec20ab7 100644 --- a/window/examples/basic_opengl.rs +++ b/window/examples/basic_opengl.rs @@ -20,7 +20,7 @@ impl WindowCallbacks for MyWindow { fn paint_opengl(&mut self, frame: &mut glium::Frame) { // Window contents are gray in opengl mode use glium::Surface; - frame.clear_color(0.15, 0.15, 0.15, 1.0); + frame.clear_color_srgb(0.15, 0.15, 0.15, 1.0); } fn as_any(&mut self) -> &mut dyn Any { diff --git a/window/src/lib.rs b/window/src/lib.rs index be8162162..5242c26cc 100644 --- a/window/src/lib.rs +++ b/window/src/lib.rs @@ -129,7 +129,7 @@ pub trait WindowCallbacks: Any { #[cfg(feature = "opengl")] fn paint_opengl(&mut self, frame: &mut glium::Frame) { use glium::Surface; - frame.clear_color(0.25, 0.125, 0.375, 1.0); + frame.clear_color_srgb(0.25, 0.125, 0.375, 1.0); } /// Called to handle a key event.