Dont add alpha when rendering alpha mask on canvas

Instead use the larger of the two alphas. This gives better results
for overlapping text, such as the infinite length ligature glyphs used
by FiraCode. I dont think adding ever gave better results anyway.
This commit is contained in:
Kovid Goyal 2021-02-15 16:08:06 +05:30
parent ba005e991a
commit 886309850f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 3 deletions

View File

@ -70,7 +70,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Improve handling of infinite length ligatures in newer versions of FiraCode
and CascadiaCode. Now such ligatures are detected based on glyph naming
convention, this removes the gap in the ligatures at cell boundaries (:iss:`2695`)
convention. This removes the gap in the ligatures at cell boundaries (:iss:`2695`)
0.19.3 [2020-12-19]

View File

@ -667,9 +667,10 @@ render_alpha_mask(uint8_t *alpha_mask, pixel* dest, Region *src_rect, Region *de
pixel *d = dest + dest_stride * dr;
uint8_t *s = alpha_mask + src_stride * sr;
for(size_t sc = src_rect->left, dc = dest_rect->left; sc < src_rect->right && dc < dest_rect->right; sc++, dc++) {
pixel val = d[dc];
uint8_t src_alpha = d[dc] & 0xff;
uint8_t alpha = s[sc];
d[dc] = 0xffffff00 | MIN(0xffu, alpha + (val & 0xff));
uint8_t combined_alpha = MAX(alpha, src_alpha);
d[dc] = 0xffffff00 | MIN(0xffu, combined_alpha);
}
}
}