cogl: Make sure alpha is correctly set for hsla Colors

As the color is initiallized with init_from_hls which always sets
alpha to 1.0

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3544>
This commit is contained in:
Bilal Elmoussaoui 2024-06-13 02:32:19 +02:00
parent dc52ccc75a
commit 93ded65b7d

View File

@ -181,7 +181,7 @@ parse_hsla (CoglColor *color,
gboolean has_alpha) gboolean has_alpha)
{ {
gdouble number; gdouble number;
gdouble h, l, s; gdouble h, l, s, alpha;
skip_whitespace (&str); skip_whitespace (&str);
@ -246,16 +246,17 @@ parse_hsla (CoglColor *color,
skip_whitespace (&str); skip_whitespace (&str);
number = g_ascii_strtod (str, &str); number = g_ascii_strtod (str, &str);
color->alpha = CLAMP (number * 255.0, 0, 255); alpha = CLAMP (number * 255.0, 0, 255);
} }
else else
color->alpha = 255; alpha = 255;
skip_whitespace (&str); skip_whitespace (&str);
if (*str != ')') if (*str != ')')
return FALSE; return FALSE;
cogl_color_init_from_hsl (color, h, s, l); cogl_color_init_from_hsl (color, h, s, l);
color->alpha = alpha;
return TRUE; return TRUE;
} }