mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 14:34:52 +02:00
Properly blank bar area
Otherwise the rounded rect frame lets content from below the bar shine through at the corners
This commit is contained in:
10
kitty/gl.c
10
kitty/gl.c
@@ -186,6 +186,16 @@ restore_viewport(void) {
|
|||||||
glViewport(saved_viewport[0], saved_viewport[1], saved_viewport[2], saved_viewport[3]);
|
glViewport(saved_viewport[0], saved_viewport[1], saved_viewport[2], saved_viewport[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
enable_scissor_using_top_left_origin(Viewport vp, unsigned full_framebuffer_height) {
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
GLsizei newy = full_framebuffer_height - (vp.top + vp.height);
|
||||||
|
glScissor(vp.left, newy, vp.width, vp.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
disable_scissor(void) { glDisable(GL_SCISSOR_TEST); }
|
||||||
|
|
||||||
static float
|
static float
|
||||||
linear_to_srgb(float c) { return (c <= 0.0031308f) ? 12.92f * c : 1.055f * powf(c, 1.0f / 2.4f) - 0.055f; }
|
linear_to_srgb(float c) { return (c <= 0.0031308f) ? 12.92f * c : 1.055f * powf(c, 1.0f / 2.4f) - 0.055f; }
|
||||||
|
|
||||||
|
|||||||
@@ -67,3 +67,5 @@ void check_framebuffer_status_or_die(void);
|
|||||||
void restore_viewport(void);
|
void restore_viewport(void);
|
||||||
void bind_framebuffer_for_output(unsigned fbid);
|
void bind_framebuffer_for_output(unsigned fbid);
|
||||||
void set_framebuffer_to_use_for_output(unsigned fbid);
|
void set_framebuffer_to_use_for_output(unsigned fbid);
|
||||||
|
void enable_scissor_using_top_left_origin(Viewport, unsigned);
|
||||||
|
void disable_scissor(void);
|
||||||
|
|||||||
@@ -803,11 +803,17 @@ render_a_bar(const UIRenderData *ui, WindowBarData *bar, PyObject *title, bool a
|
|||||||
.height=bar_height + 2 * border_width, .left=ui->screen_left, .width=ui->screen_width, .top=ui->screen_top};
|
.height=bar_height + 2 * border_width, .left=ui->screen_left, .width=ui->screen_width, .top=ui->screen_top};
|
||||||
if (along_bottom) border_rect.top += ui->screen_height - border_rect.height;
|
if (along_bottom) border_rect.top += ui->screen_height - border_rect.height;
|
||||||
const unsigned sh = ui->full_framebuffer_height;
|
const unsigned sh = ui->full_framebuffer_height;
|
||||||
|
// first blank the area to be drawn to background
|
||||||
|
enable_scissor_using_top_left_origin(border_rect, sh);
|
||||||
|
blank_canvas(1.f, bg);
|
||||||
|
disable_scissor();
|
||||||
|
// then draw the rendered text
|
||||||
save_viewport_using_top_left_origin(
|
save_viewport_using_top_left_origin(
|
||||||
border_rect.left + border_width, border_rect.top + border_width, bar_width, bar_height, sh);
|
border_rect.left + border_width, border_rect.top + border_width, bar_width, bar_height, sh);
|
||||||
draw_graphics(GRAPHICS_PROGRAM, &data, 0, 1, 1.f);
|
draw_graphics(GRAPHICS_PROGRAM, &data, 0, 1, 1.f);
|
||||||
restore_viewport();
|
restore_viewport();
|
||||||
free_texture(&data.texture_id);
|
free_texture(&data.texture_id);
|
||||||
|
// finally draw border with transparent bg
|
||||||
draw_rounded_rect(ui->os_window, border_rect, sh, 1, ui->cell_width, fg, bg, 0.f);
|
draw_rounded_rect(ui->os_window, border_rect, sh, 1, ui->cell_width, fg, bg, 0.f);
|
||||||
return border_rect.height;
|
return border_rect.height;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user