Fix lines at the edge of the window at certain windows sizes when drawing images on a transparent window

Fixes #2079
Fixes #2214
This commit is contained in:
Kovid Goyal 2019-12-19 20:41:31 +05:30
parent 18f0ab9e02
commit 689d059517
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 10 additions and 5 deletions

View File

@ -22,6 +22,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Add a new option :opt:`active_tab_title_template` to specify a different - Add a new option :opt:`active_tab_title_template` to specify a different
template for active tab titles (:iss:`2198`) template for active tab titles (:iss:`2198`)
- Fix lines at the edge of the window at certain windows sizes when drawing
images on a transparent window (:iss:`2079`)
0.15.0 [2019-11-27] 0.15.0 [2019-11-27]
-------------------- --------------------

View File

@ -509,13 +509,15 @@ draw_cells(ssize_t vao_idx, ssize_t gvao_idx, GLfloat xstart, GLfloat ystart, GL
// The scissor limits below are calculated to ensure that they do not // The scissor limits below are calculated to ensure that they do not
// overlap with the pixels outside the draw area, // overlap with the pixels outside the draw area,
// for a test case (scissor is also used to blit framebuffer in draw_cells_interleaved_premult) run: // for a test case (scissor is also used to blit framebuffer in draw_cells_interleaved_premult) run:
// kitty -o background=cyan -o background_opacity=0.7 -o window_margin_width=40 sh -c "kitty +kitten icat logo/kitty.png; read" // kitty -o background=cyan -o background_opacity=0.7 -o cursor_blink_interval=0 -o window_margin_width=40 sh -c "kitty +kitten icat logo/kitty.png; read"
#define SCALE(w, x) ((GLfloat)(os_window->viewport_##w) * (GLfloat)(x)) #define SCALE(w, x) ((GLfloat)(os_window->viewport_##w) * (GLfloat)(x))
/* printf("columns=%d dx=%f w=%f vw=%d vh=%d left=%f width=%f\n", screen->columns, dx, w, os_window->viewport_width, os_window->viewport_height, SCALE(width, (xstart + 1.f)/2.f), SCALE(width, w / 2.f)); */
glScissor( glScissor(
(GLint)(ceilf(SCALE(width, (xstart + 1.0f) / 2.0f))), // x (GLint)roundf(SCALE(width, (xstart + 1.f)/2.f)), // x
(GLint)(ceilf(SCALE(height, ((ystart - h) + 1.0f) / 2.0f))), // y (GLint)roundf(SCALE(height, (ystart - h + 1.f)/2.f)), // y
(GLsizei)(floorf(SCALE(width, w / 2.0f))), // width (GLsizei)roundf(SCALE(width, w / 2.f)), // width
(GLsizei)(floorf(SCALE(height, h / 2.0f))) // height (GLsizei)roundf(SCALE(height, h / 2.f)) // height
); );
#undef SCALE #undef SCALE
if (os_window->is_semi_transparent) { if (os_window->is_semi_transparent) {