Bilal Elmoussaoui
2024-02-16 23:15:40 +01:00
committed by Marge Bot
parent 40dde833af
commit cf0803ab71
8 changed files with 32 additions and 100 deletions

View File

@ -89,10 +89,10 @@ test_coglbox_fade_texture (CoglFramebuffer *framebuffer,
255,
((i ^ (i >> 1)) & 1) ? 0 : 128);
cogl_color_premultiply (&cogl_color);
vertices[i].r = cogl_color_get_red_byte (&cogl_color);
vertices[i].g = cogl_color_get_green_byte (&cogl_color);
vertices[i].b = cogl_color_get_blue_byte (&cogl_color);
vertices[i].a = cogl_color_get_alpha_byte (&cogl_color);
vertices[i].r = cogl_color_get_red (&cogl_color) * 255.0;
vertices[i].g = cogl_color_get_green (&cogl_color) * 255.0;
vertices[i].b = cogl_color_get_blue (&cogl_color) * 255.0;
vertices[i].a = cogl_color_get_alpha (&cogl_color) * 255.0;
}
primitive =

View File

@ -13,7 +13,7 @@ test_color_hsl (void)
CoglColor color;
float hue, saturation, luminance;
cogl_color_init_from_4ub(&color, 108, 198, 78, 255);
cogl_color_init_from_4f (&color, 108.0 / 255.0, 198 / 255.0, 78.0 / 255.0, 1.0);
cogl_color_to_hsl(&color, &hue, &saturation, &luminance);
g_assert_cmpfloat_with_epsilon (hue, 105.f, TEST_CASE_EPSILON);
@ -21,15 +21,19 @@ test_color_hsl (void)
g_assert_cmpfloat_with_epsilon (luminance, 0.541176, TEST_CASE_EPSILON);
memset(&color, 0, sizeof (CoglColor));
cogl_color_init_from_hsl(&color, hue, saturation, luminance);
cogl_color_init_from_hsl (&color, hue, saturation, luminance);
g_assert_cmpint (cogl_color_get_red_byte (&color), ==, 108);
g_assert_cmpint (cogl_color_get_green_byte (&color), ==, 198);
g_assert_cmpint (cogl_color_get_blue_byte (&color), ==, 78);
g_assert_cmpint (cogl_color_get_alpha_byte (&color), ==, 255);
g_assert_cmpfloat_with_epsilon (cogl_color_get_red (&color), 108.0 / 255.0,
TEST_CASE_EPSILON);
g_assert_cmpfloat_with_epsilon (cogl_color_get_green (&color), 198.0 / 255.0,
TEST_CASE_EPSILON);
g_assert_cmpfloat_with_epsilon (cogl_color_get_blue (&color), 78.0 / 255.0,
TEST_CASE_EPSILON);
g_assert_cmpfloat_with_epsilon (cogl_color_get_alpha (&color), 1.0,
TEST_CASE_EPSILON);
memset(&color, 0, sizeof (CoglColor));
cogl_color_init_from_hsl(&color, hue, 0, luminance);
cogl_color_init_from_hsl (&color, hue, 0, luminance);
g_assert_cmpfloat_with_epsilon (cogl_color_get_red (&color), luminance,
TEST_CASE_EPSILON);