last rendered cursor_bg color and re-use it when trail rendering

This commit is contained in:
Rick Choi
2024-10-19 18:16:26 +09:00
parent 25caf90a80
commit fe63c6ddfd
2 changed files with 5 additions and 3 deletions

View File

@@ -97,6 +97,7 @@ typedef struct {
struct { struct {
unsigned int cursor_x, cursor_y, scrolled_by; unsigned int cursor_x, cursor_y, scrolled_by;
index_type lines, columns; index_type lines, columns;
color_type cursor_bg;
} last_rendered; } last_rendered;
bool is_dirty, scroll_changed, reload_all_gpu_data; bool is_dirty, scroll_changed, reload_all_gpu_data;
Cursor *cursor; Cursor *cursor;

View File

@@ -385,6 +385,9 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, c
#undef COLOR #undef COLOR
rd->url_color = OPT(url_color); rd->url_style = OPT(url_style); 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; 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_x, 1, trail->cursor_edge_x);
glUniform2fv(trail_program_layout.uniforms.cursor_edge_y, 1, trail->cursor_edge_y); glUniform2fv(trail_program_layout.uniforms.cursor_edge_y, 1, trail->cursor_edge_y);
ColorProfile *cp = trail->screen->color_profile; color_vec3(trail_program_layout.uniforms.trail_color, trail->screen->last_rendered.cursor_bg);
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);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4); glDrawArrays(GL_TRIANGLE_FAN, 0, 4);