Fix one-pixel line appearing at window edges at some window sizes when displaying images with background opacity enabled

Fixes #741
This commit is contained in:
Kovid Goyal 2018-08-12 07:22:25 +05:30
parent ea8b17565d
commit 6e34a7559b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 10 additions and 4 deletions

View File

@ -34,6 +34,9 @@ Changelog
takes parameters so you can define your own shortcuts to clear the
screen/scrollback also (:iss:`747`)
- Fix one-pixel line appearing at window edges at some window sizes when
displaying images with background opacity enabled (:iss:`741`)
- diff kitten: Fix error when right hand side file is binary and left hand side
file is text (:pull:`752`)

View File

@ -456,12 +456,15 @@ draw_cells(ssize_t vao_idx, ssize_t gvao_idx, GLfloat xstart, GLfloat ystart, GL
float current_inactive_text_alpha = (!can_be_focused || screen->cursor_render_info.is_focused) && is_active_window ? 1.0 : OPT(inactive_text_alpha);
set_cell_uniforms(current_inactive_text_alpha);
GLfloat w = (GLfloat)screen->columns * dx, h = (GLfloat)screen->lines * dy;
// The scissor limits below are calculated to ensure that they do not
// overlap with the pixels outside the draw area, see https://github.com/kovidgoyal/kitty/issues/741
// for a test case (the scissor is also used by draw_cells_interleaved_premult to blit the framebuffer)
#define SCALE(w, x) ((GLfloat)(os_window->viewport_##w) * (GLfloat)(x))
glScissor(
(GLint)(SCALE(width, (xstart + 1.0f) / 2.0f)),
(GLint)(SCALE(height, ((ystart - h) + 1.0f) / 2.0f)),
(GLsizei)(ceilf(SCALE(width, w / 2.0f))),
(GLsizei)(ceilf(SCALE(height, h / 2.0f)))
(GLint)(ceilf(SCALE(width, (xstart + 1.0f) / 2.0f))),
(GLint)(ceilf(SCALE(height, ((ystart - h) + 1.0f) / 2.0f))),
(GLsizei)(floorf(SCALE(width, w / 2.0f))-1),
(GLsizei)(floorf(SCALE(height, h / 2.0f))-1)
);
#undef SCALE
if (os_window->is_semi_transparent) {