Merge branch 'fix_white_background_transparency' of https://github.com/Luflosi/kitty

This commit is contained in:
Kovid Goyal 2019-01-14 13:10:15 +05:30
commit a827f4190c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 10 additions and 3 deletions

View File

@ -26,6 +26,9 @@ Changelog
negative :opt:`wheel_scroll_multiplier` values in full-screen applications
like vim (:iss:`1299`)
- Fix :opt:`background_opacity` not working with pure white backgrounds
(:iss:`1285`)
0.13.2 [2019-01-04]
------------------------------

View File

@ -4,5 +4,5 @@ in vec3 color;
out vec4 final_color;
void main() {
final_color = vec4(color, background_opacity);
final_color = vec4(color * background_opacity, background_opacity);
}

View File

@ -72,7 +72,11 @@ vec4 calculate_foreground() {
void main() {
#ifdef BACKGROUND
#ifdef TRANSPARENT
final_color = vec4(background.rgb * bg_alpha, bg_alpha);
// bg_alpha is doubled to match rendering in the SIMPLE case
// and also rendering of the margin/padding, see https://github.com/kovidgoyal/kitty/pull/1291
// to test use background_opacity, window_margin_width and icat to display
// an image.
final_color = vec4(background.rgb * bg_alpha * bg_alpha, bg_alpha);
#else
final_color = vec4(background.rgb, 1.0f);
#endif
@ -101,7 +105,7 @@ void main() {
#else
// SIMPLE
#ifdef TRANSPARENT
final_color = alpha_blend_premul(fg.rgb, fg.a, background, bg_alpha);
final_color = alpha_blend_premul(fg.rgb, fg.a, background * bg_alpha, bg_alpha);
final_color = vec4(final_color.rgb, final_color.a);
#else
// since background alpha is 1.0, it is effectively pre-multiplied