From 93ded65b7dab9f4b8379586bd5702e57a4a4c576 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Thu, 13 Jun 2024 02:32:19 +0200 Subject: [PATCH] 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: --- cogl/cogl/cogl-color.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cogl/cogl/cogl-color.c b/cogl/cogl/cogl-color.c index 1b7b2d729..38a2a62b0 100644 --- a/cogl/cogl/cogl-color.c +++ b/cogl/cogl/cogl-color.c @@ -181,7 +181,7 @@ parse_hsla (CoglColor *color, gboolean has_alpha) { gdouble number; - gdouble h, l, s; + gdouble h, l, s, alpha; skip_whitespace (&str); @@ -246,16 +246,17 @@ parse_hsla (CoglColor *color, skip_whitespace (&str); number = g_ascii_strtod (str, &str); - color->alpha = CLAMP (number * 255.0, 0, 255); + alpha = CLAMP (number * 255.0, 0, 255); } else - color->alpha = 255; + alpha = 255; skip_whitespace (&str); if (*str != ')') return FALSE; cogl_color_init_from_hsl (color, h, s, l); + color->alpha = alpha; return TRUE; }