mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-10 07:59:24 +02:00
move trail color decision logic to shader.c
This commit is contained in:
@@ -45,6 +45,7 @@ update_cursor_trail_target(CursorTrail *ct, Window *w) {
|
||||
EDGE(x, 1) = right;
|
||||
EDGE(y, 0) = top;
|
||||
EDGE(y, 1) = bottom;
|
||||
ct->screen = WD.screen;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,13 +120,9 @@ update_cursor_trail(CursorTrail *ct, Window *w, monotonic_t now, OSWindow *os_wi
|
||||
ct->needs_render = true;
|
||||
}
|
||||
|
||||
if (ct->needs_render) {
|
||||
ColorProfile *cp = WD.screen->color_profile;
|
||||
ct->color = colorprofile_to_color(cp, cp->overridden.cursor_color, cp->configured.cursor_color).rgb;
|
||||
}
|
||||
|
||||
#undef WD
|
||||
#undef EDGE
|
||||
// returning true here will cause the cells to be drawn
|
||||
return ct->needs_render || needs_render_prev;
|
||||
}
|
||||
|
||||
#undef WD
|
||||
#undef EDGE
|
||||
|
||||
@@ -1154,7 +1154,9 @@ 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);
|
||||
|
||||
color_vec3(trail_program_layout.uniforms.trail_color, trail->color);
|
||||
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);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
bool needs_render;
|
||||
monotonic_t updated_at;
|
||||
color_type color;
|
||||
Screen* screen;
|
||||
float corner_x[4];
|
||||
float corner_y[4];
|
||||
float cursor_edge_x[2];
|
||||
|
||||
Reference in New Issue
Block a user