From fe63c6ddfd440512ec3680bdd9b3e2a628d10b4c Mon Sep 17 00:00:00 2001 From: Rick Choi Date: Sat, 19 Oct 2024 18:16:26 +0900 Subject: [PATCH] last rendered cursor_bg color and re-use it when trail rendering --- kitty/screen.h | 1 + kitty/shaders.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kitty/screen.h b/kitty/screen.h index 71e78ecfb..e71c6ac6a 100644 --- a/kitty/screen.h +++ b/kitty/screen.h @@ -97,6 +97,7 @@ typedef struct { struct { unsigned int cursor_x, cursor_y, scrolled_by; index_type lines, columns; + color_type cursor_bg; } last_rendered; bool is_dirty, scroll_changed, reload_all_gpu_data; Cursor *cursor; diff --git a/kitty/shaders.c b/kitty/shaders.c index a44cb4b86..e64440169 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -385,6 +385,9 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, c #undef COLOR rd->url_color = OPT(url_color); rd->url_style = OPT(url_style); + // store last rendered cursor color for trail rendering + screen->last_rendered.cursor_bg = rd->cursor_bg; + unmap_vao_buffer(vao_idx, uniform_buffer); rd = NULL; } @@ -1154,9 +1157,7 @@ draw_cursor_trail(CursorTrail *trail) { glUniform2fv(trail_program_layout.uniforms.cursor_edge_x, 1, trail->cursor_edge_x); glUniform2fv(trail_program_layout.uniforms.cursor_edge_y, 1, trail->cursor_edge_y); - ColorProfile *cp = trail->screen->color_profile; - color_type color = colorprofile_to_color(cp, cp->overridden.cursor_color, cp->configured.cursor_color).rgb; - color_vec3(trail_program_layout.uniforms.trail_color, color); + color_vec3(trail_program_layout.uniforms.trail_color, trail->screen->last_rendered.cursor_bg); glDrawArrays(GL_TRIANGLE_FAN, 0, 4);