mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
render: color_hex_to_pixman_with_alpha(): handle alpha == 0 (transparent)
This commit is contained in:
parent
40f3d4c24c
commit
925088a8f2
1 changed files with 3 additions and 0 deletions
3
render.c
3
render.c
|
|
@ -218,6 +218,9 @@ color_hex_to_rgb(uint32_t color)
|
|||
static inline pixman_color_t
|
||||
color_hex_to_pixman_with_alpha(uint32_t color, uint16_t alpha)
|
||||
{
|
||||
if (alpha == 0)
|
||||
return (pixman_color_t){0, 0, 0, 0};
|
||||
|
||||
int alpha_div = 0xffff / alpha;
|
||||
return (pixman_color_t){
|
||||
.red = ((color >> 16 & 0xff) | (color >> 8 & 0xff00)) / alpha_div,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue