From 2f0b6e24c904fc84d640ab06646ad8e798cf1943 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 20 Dec 2019 08:16:10 +0530 Subject: [PATCH] Use pre-multiplied alpha when clearing windows Apparently most systems expect this. See https://github.com/glfw/glfw/issues/1538 --- kitty/shaders.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kitty/shaders.c b/kitty/shaders.c index 448a31071..bb04716a5 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -477,10 +477,11 @@ set_cell_uniforms(float current_inactive_text_alpha, bool force) { void blank_canvas(float background_opacity, color_type color) { -#define C(shift) (((GLfloat)((color >> shift) & 0xFF)) / 255.0f) - glClearColor(C(16), C(8), C(0), background_opacity); + // See https://github.com/glfw/glfw/issues/1538 for why we use pre-multiplied alpha +#define C(shift) ((((GLfloat)((color >> shift) & 0xFF)) / 255.0f) * background_opacity) + glClearColor(C(16), C(8), C(0), background_opacity); #undef C - glClear(GL_COLOR_BUFFER_BIT); + glClear(GL_COLOR_BUFFER_BIT); } bool