diff --git a/kitty/screen.c b/kitty/screen.c index d1c00a1bf..2710c0740 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1986,9 +1986,7 @@ screen_erase_characters(Screen *self, unsigned int count) { bool screen_invert_colors(Screen *self) { - bool inverted = false; - if (self->modes.mDECSCNM) inverted = true; - return inverted; + return self->paused_rendering.expires_at ? self->paused_rendering.inverted : (self->modes.mDECSCNM ? true : false); } void @@ -2374,6 +2372,7 @@ screen_pause_rendering(Screen *self, bool pause, int for_in_ms) { if (self->paused_rendering.expires_at) return false; if (for_in_ms <= 0) for_in_ms = 2000; self->paused_rendering.expires_at = monotonic() + ms_to_monotonic_t(for_in_ms); + self->paused_rendering.inverted = self->modes.mDECSCNM ? true : false; memcpy(&self->paused_rendering.cursor, self->cursor, sizeof(self->paused_rendering.cursor)); memcpy(&self->paused_rendering.color_profile, self->color_profile, sizeof(self->paused_rendering.color_profile)); return true; diff --git a/kitty/screen.h b/kitty/screen.h index d37174dfb..f6837b2a0 100644 --- a/kitty/screen.h +++ b/kitty/screen.h @@ -154,6 +154,7 @@ typedef struct { monotonic_t expires_at; Cursor cursor; ColorProfile color_profile; + bool inverted; } paused_rendering; } Screen; diff --git a/kitty/shaders.c b/kitty/shaders.c index 1e50c8435..dd3fb32f1 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -290,7 +290,7 @@ pick_cursor_color(Line *line, const ColorProfile *color_profile, color_type cell } static void -cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, const CellRenderData *crd, CursorRenderInfo *cursor, bool inverted, OSWindow *os_window) { +cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, const CellRenderData *crd, CursorRenderInfo *cursor, OSWindow *os_window) { struct GPUCellRenderData { GLfloat xstart, ystart, dx, dy, sprite_dx, sprite_dy, background_opacity, use_cell_bg_for_selection_fg, use_cell_fg_for_selection_color, use_cell_for_selection_bg; @@ -365,7 +365,7 @@ cell_update_uniform_block(ssize_t vao_idx, Screen *screen, int uniform_buffer, c unsigned int x, y, z; sprite_tracker_current_layout(os_window->fonts_data, &x, &y, &z); rd->sprite_dx = 1.0f / (float)x; rd->sprite_dy = 1.0f / (float)y; - rd->inverted = inverted ? 1 : 0; + rd->inverted = screen_invert_colors(screen) ? 1 : 0; rd->background_opacity = os_window->is_semi_transparent ? os_window->background_opacity : 1.0f; #undef COLOR @@ -919,13 +919,12 @@ draw_cells(ssize_t vao_idx, const WindowRenderData *srd, OSWindow *os_window, bo } Screen *screen = srd->screen; CELL_BUFFERS; - bool inverted = screen_invert_colors(screen); CellRenderData crd = { .gl={.xstart = srd->xstart, .ystart = srd->ystart, .dx = srd->dx * x_ratio, .dy = srd->dy * y_ratio}, .x_ratio=x_ratio, .y_ratio=y_ratio }; crd.gl.width = crd.gl.dx * screen->columns; crd.gl.height = crd.gl.dy * screen->lines; - cell_update_uniform_block(vao_idx, screen, uniform_buffer, &crd, &screen->cursor_render_info, inverted, os_window); + cell_update_uniform_block(vao_idx, screen, uniform_buffer, &crd, &screen->cursor_render_info, os_window); bind_vao_uniform_buffer(vao_idx, uniform_buffer, cell_program_layouts[CELL_PROGRAM].render_data.index); bind_vertex_array(vao_idx);