mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-20 20:22:10 +00: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:
parent
5ef5b5f363
commit
3ae489b151
2 changed files with 13 additions and 3 deletions
|
|
@ -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
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue