Fix rendering of semi-transparent cursors

This commit is contained in:
Kovid Goyal
2024-07-19 08:58:24 +05:30
parent 3db2ce33b1
commit 942cbea4b5
2 changed files with 2 additions and 2 deletions

View File

@@ -134,7 +134,7 @@ vec4 calculate_premul_foreground_from_sprites(vec4 text_fg) {
float combined_alpha = min(text_fg.a + strike_alpha, 1.0f);
// Underline color might be different, so alpha blend
vec4 ans = alpha_blend(vec4(text_fg.rgb, combined_alpha * effective_text_alpha), vec4(decoration_fg, underline_alpha * effective_text_alpha));
return mix(ans, cursor_color_premult, cursor_alpha);
return mix(ans, cursor_color_premult, cursor_alpha * cursor_color_premult.a);
}
vec4 adjust_foreground_contrast_with_background(vec4 text_fg, vec3 bg) {

View File

@@ -186,7 +186,7 @@ void main() {
// Cursor
cursor_color_premult = vec4(color_to_vec(cursor_bg) * cursor_opacity, cursor_opacity);
vec3 final_cursor_text_color = color_to_vec(cursor_fg);
vec3 final_cursor_text_color = mix(foreground, color_to_vec(cursor_fg), cursor_opacity);
foreground = choose_color(cell_data.has_block_cursor, final_cursor_text_color, foreground);
decoration_fg = choose_color(cell_data.has_block_cursor, final_cursor_text_color, decoration_fg);
cursor_pos = to_sprite_pos(cell_data.pos, cursor_fg_sprite_idx * uint(cell_data.has_cursor), ZERO, ZERO);