1
0
Fork 0

cogl: Remove Color.get_*_float

They are exactly the same as the get_* variants

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3594>
This commit is contained in:
Bilal Elmoussaoui 2024-02-16 22:44:37 +01:00 committed by Marge Bot
parent 77f95d2203
commit 40dde833af
6 changed files with 20 additions and 96 deletions

View file

@ -93,12 +93,6 @@ cogl_color_get_red_byte (const CoglColor *color)
return color->red;
}
float
cogl_color_get_red_float (const CoglColor *color)
{
return (float) color->red / 255.0;
}
float
cogl_color_get_red (const CoglColor *color)
{
@ -111,12 +105,6 @@ cogl_color_get_green_byte (const CoglColor *color)
return color->green;
}
float
cogl_color_get_green_float (const CoglColor *color)
{
return (float) color->green / 255.0;
}
float
cogl_color_get_green (const CoglColor *color)
{
@ -129,12 +117,6 @@ cogl_color_get_blue_byte (const CoglColor *color)
return color->blue;
}
float
cogl_color_get_blue_float (const CoglColor *color)
{
return (float) color->blue / 255.0;
}
float
cogl_color_get_blue (const CoglColor *color)
{
@ -147,12 +129,6 @@ cogl_color_get_alpha_byte (const CoglColor *color)
return color->alpha;
}
float
cogl_color_get_alpha_float (const CoglColor *color)
{
return (float) color->alpha / 255.0;
}
float
cogl_color_get_alpha (const CoglColor *color)
{

View file

@ -163,54 +163,6 @@ cogl_color_get_blue_byte (const CoglColor *color);
COGL_EXPORT unsigned char
cogl_color_get_alpha_byte (const CoglColor *color);
/**
* cogl_color_get_red_float:
* @color: a #CoglColor
*
* Retrieves the red channel of @color as a floating point
* value between 0.0 and 1.0
*
* Return value: the red channel of the passed color
*/
COGL_EXPORT float
cogl_color_get_red_float (const CoglColor *color);
/**
* cogl_color_get_green_float:
* @color: a #CoglColor
*
* Retrieves the green channel of @color as a floating point
* value between 0.0 and 1.0
*
* Return value: the green channel of the passed color
*/
COGL_EXPORT float
cogl_color_get_green_float (const CoglColor *color);
/**
* cogl_color_get_blue_float:
* @color: a #CoglColor
*
* Retrieves the blue channel of @color as a floating point
* value between 0.0 and 1.0
*
* Return value: the blue channel of the passed color
*/
COGL_EXPORT float
cogl_color_get_blue_float (const CoglColor *color);
/**
* cogl_color_get_alpha_float:
* @color: a #CoglColor
*
* Retrieves the alpha channel of @color as a floating point
* value between 0.0 and 1.0
*
* Return value: the alpha channel of the passed color
*/
COGL_EXPORT float
cogl_color_get_alpha_float (const CoglColor *color);
/**
* cogl_color_get_red:
* @color: a #CoglColor

View file

@ -645,10 +645,10 @@ cogl_framebuffer_clear (CoglFramebuffer *framebuffer,
const CoglColor *color)
{
cogl_framebuffer_clear4f (framebuffer, buffers,
cogl_color_get_red_float (color),
cogl_color_get_green_float (color),
cogl_color_get_blue_float (color),
cogl_color_get_alpha_float (color));
cogl_color_get_red (color),
cogl_color_get_green (color),
cogl_color_get_blue (color),
cogl_color_get_alpha (color));
}
/* We will lazily allocate framebuffers if necessary when querying

View file

@ -1029,10 +1029,10 @@ cogl_pipeline_set_layer_combine_constant (CoglPipeline *pipeline,
* state we want to change */
authority = _cogl_pipeline_layer_get_authority (layer, state);
color_as_floats[0] = cogl_color_get_red_float (constant_color);
color_as_floats[1] = cogl_color_get_green_float (constant_color);
color_as_floats[2] = cogl_color_get_blue_float (constant_color);
color_as_floats[3] = cogl_color_get_alpha_float (constant_color);
color_as_floats[0] = cogl_color_get_red (constant_color);
color_as_floats[1] = cogl_color_get_green (constant_color);
color_as_floats[2] = cogl_color_get_blue (constant_color);
color_as_floats[3] = cogl_color_get_alpha (constant_color);
if (memcmp (authority->big_state->texture_combine_constant,
color_as_floats, sizeof (float) * 4) == 0)

View file

@ -321,14 +321,10 @@ _cogl_pipeline_flush_color_blend_alpha_depth_state (
blend_factor_uses_constant (blend_state->blend_dst_factor_rgb) ||
blend_factor_uses_constant (blend_state->blend_dst_factor_alpha))
{
float red =
cogl_color_get_red_float (&blend_state->blend_constant);
float green =
cogl_color_get_green_float (&blend_state->blend_constant);
float blue =
cogl_color_get_blue_float (&blend_state->blend_constant);
float alpha =
cogl_color_get_alpha_float (&blend_state->blend_constant);
float red = cogl_color_get_red (&blend_state->blend_constant);
float green = cogl_color_get_green (&blend_state->blend_constant);
float blue = cogl_color_get_blue (&blend_state->blend_constant);
float alpha = cogl_color_get_alpha (&blend_state->blend_constant);
GE (ctx, glBlendColor (red, green, blue, alpha));
@ -1117,10 +1113,10 @@ done:
if (attribute != -1)
GE (ctx,
glVertexAttrib4f (attribute,
cogl_color_get_red_float (&authority->color),
cogl_color_get_green_float (&authority->color),
cogl_color_get_blue_float (&authority->color),
cogl_color_get_alpha_float (&authority->color)));
cogl_color_get_red (&authority->color),
cogl_color_get_green (&authority->color),
cogl_color_get_blue (&authority->color),
cogl_color_get_alpha (&authority->color)));
}
/* Give the progend a chance to update any uniforms that might not

View file

@ -31,13 +31,13 @@ test_color_hsl (void)
memset(&color, 0, sizeof (CoglColor));
cogl_color_init_from_hsl(&color, hue, 0, luminance);
g_assert_cmpfloat_with_epsilon (cogl_color_get_red_float (&color), luminance,
g_assert_cmpfloat_with_epsilon (cogl_color_get_red (&color), luminance,
TEST_CASE_EPSILON);
g_assert_cmpfloat_with_epsilon (cogl_color_get_green_float (&color), luminance,
g_assert_cmpfloat_with_epsilon (cogl_color_get_green (&color), luminance,
TEST_CASE_EPSILON);
g_assert_cmpfloat_with_epsilon (cogl_color_get_blue_float (&color), luminance,
g_assert_cmpfloat_with_epsilon (cogl_color_get_blue (&color), luminance,
TEST_CASE_EPSILON);
g_assert_cmpfloat_with_epsilon (cogl_color_get_alpha_float (&color), 1.0,
g_assert_cmpfloat_with_epsilon (cogl_color_get_alpha (&color), 1.0,
TEST_CASE_EPSILON);
if (cogl_test_verbose ())