cleanup: Prefer CoglColor.init_form_4f

As we are slowly moving colors to be represented by a [0, 1] floats.
The unsigned integer variant will likely be removed in the near future, so be
ready for that already

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3147>
This commit is contained in:
Bilal Elmoussaoui 2024-01-29 14:27:07 +01:00
parent 43d4a12576
commit cd33baff7d
2 changed files with 11 additions and 11 deletions

View File

@ -558,7 +558,7 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec,
return NULL;
}
cogl_color_init_from_4ub (&clear_color, 0, 0, 0, 0);
cogl_color_init_from_4f (&clear_color, 0.0, 0.0, 0.0, 0.0);
clutter_actor_get_position (actor, &x, &y);
x *= resource_scale;
y *= resource_scale;
@ -787,11 +787,11 @@ _st_paint_shadow_with_opacity (StShadow *shadow_spec,
st_shadow_get_box (shadow_spec, box, &shadow_box);
cogl_color_init_from_4ub (&color,
shadow_spec->color.red * paint_opacity / 255,
shadow_spec->color.green * paint_opacity / 255,
shadow_spec->color.blue * paint_opacity / 255,
shadow_spec->color.alpha * paint_opacity / 255);
cogl_color_init_from_4f (&color,
shadow_spec->color.red / 255.0 * paint_opacity / 255.0,
shadow_spec->color.green / 255.0 * paint_opacity / 255.0,
shadow_spec->color.blue / 255.0 * paint_opacity / 255.0,
shadow_spec->color.alpha / 255.0 * paint_opacity / 255.0);
cogl_color_premultiply (&color);
cogl_pipeline_set_layer_combine_constant (shadow_pipeline, 0, &color);
cogl_framebuffer_draw_rectangle (framebuffer,

View File

@ -2120,11 +2120,11 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
right += xoffset;
/* Setup pipeline */
cogl_color_init_from_4ub (&color,
box_shadow_spec->color.red * paint_opacity / 255,
box_shadow_spec->color.green * paint_opacity / 255,
box_shadow_spec->color.blue * paint_opacity / 255,
box_shadow_spec->color.alpha * paint_opacity / 255);
cogl_color_init_from_4f (&color,
box_shadow_spec->color.red / 255.0 * paint_opacity / 255.0,
box_shadow_spec->color.green / 255.0 * paint_opacity / 255.0,
box_shadow_spec->color.blue / 255.0 * paint_opacity / 255.0,
box_shadow_spec->color.alpha / 255.0 * paint_opacity / 255.0);
cogl_color_premultiply (&color);
cogl_pipeline_set_layer_combine_constant (state->box_shadow_pipeline, 0, &color);