mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-11 02:59:40 +02:00
Fix #6345
@m4rw3r this is fixing a bug in #6218. Seems fairly straightforward but since it's your code, please review.
This commit is contained in:
@@ -5,6 +5,16 @@ uniform sampler2D image;
|
||||
in vec2 texcoord;
|
||||
out vec4 color;
|
||||
|
||||
float linear2srgb(float x) {
|
||||
// Linear to sRGB conversion.
|
||||
float lower = 12.92 * x;
|
||||
float upper = 1.055 * pow(x, 1.0f / 2.4f) - 0.055f;
|
||||
|
||||
return mix(lower, upper, step(0.0031308f, x));
|
||||
}
|
||||
|
||||
|
||||
void main() {
|
||||
color = texture(image, texcoord);
|
||||
color.a = linear2srgb(color.a);
|
||||
}
|
||||
|
||||
@@ -240,9 +240,9 @@ void main() {
|
||||
#ifdef FOREGROUND
|
||||
final_color = calculate_foreground(); // pre-multiplied foreground
|
||||
|
||||
// This is the last pass, adjust alpha to compensate for gamma-incorrect
|
||||
// blending in compositor:
|
||||
final_color.a = linear2srgb(final_color.a);
|
||||
// This is the last pass, called both with transparency and without but not in draw_cells_simple().
|
||||
// When transparent it is drawn into a framebuffer and linear2srgb() will be done
|
||||
// when blitting that framebuffer. When not transparent there is not need to do linear2srgb() anyway.
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user