css number value: More color coord fixes

Always use gtk_css_number_value_new_color_component to create
new color component values, and make that function simplify things
as far as possible.
This commit is contained in:
Matthias Clasen 2024-07-07 07:36:08 -04:00
parent 95c21acec1
commit 827aa9ca05

View File

@ -324,17 +324,15 @@ gtk_css_value_number_compute (GtkCssValue *number,
if (number->type == TYPE_COLOR_COORD)
{
GtkCssValue *color;
float v;
GtkCssValue *color, *result;;
color = gtk_css_value_compute (number->color_coord.color, property_id, context);
v = gtk_css_color_value_get_coord (color,
number->color_coord.color_space,
number->color_coord.legacy_rgb_scale,
number->color_coord.coord);
result = gtk_css_number_value_new_color_component (color,
number->color_coord.color_space,
number->color_coord.legacy_rgb_scale,
number->color_coord.coord);
gtk_css_value_unref (color);
return gtk_css_number_value_new (v, GTK_CSS_NUMBER);
return result;
}
else if (number->type != TYPE_DIMENSION)
{
@ -608,17 +606,15 @@ gtk_css_value_number_resolve (GtkCssValue *number,
{
if (number->type == TYPE_COLOR_COORD)
{
GtkCssValue *color;
float v;
GtkCssValue *color, *result;
color = gtk_css_value_resolve (number->color_coord.color, context, current);
v = gtk_css_color_value_get_coord (color,
number->color_coord.color_space,
number->color_coord.legacy_rgb_scale,
number->color_coord.coord);
result = gtk_css_number_value_new_color_component (color,
number->color_coord.color_space,
number->color_coord.legacy_rgb_scale,
number->color_coord.coord);
gtk_css_value_unref (color);
return gtk_css_number_value_new (v, GTK_CSS_NUMBER);
return result;
}
else if (number->type != TYPE_DIMENSION)
{