hsla: Just store floats

We are using floats for rgb, and we don't need more precision
for hsl colors either. We use hsl for computing color expressions
like shade(), lighter() and darker(), which are not precisely
specified anyway.

This commit updates the one test where the output changes a
tiny bit due to this.
This commit is contained in:
Matthias Clasen 2020-07-25 00:29:42 -04:00
parent 54deed9a5a
commit 706aa93ab5
3 changed files with 25 additions and 25 deletions

View File

@ -23,10 +23,10 @@
void
_gtk_hsla_init (GtkHSLA *hsla,
double hue,
double saturation,
double lightness,
double alpha)
float hue,
float saturation,
float lightness,
float alpha)
{
g_return_if_fail (hsla != NULL);
@ -43,12 +43,12 @@ void
_gtk_hsla_init_from_rgba (GtkHSLA *hsla,
const GdkRGBA *rgba)
{
double min;
double max;
double red;
double green;
double blue;
double delta;
float min;
float max;
float red;
float green;
float blue;
float delta;
g_return_if_fail (hsla != NULL);
g_return_if_fail (rgba != NULL);
@ -112,10 +112,10 @@ void
_gdk_rgba_init_from_hsla (GdkRGBA *rgba,
const GtkHSLA *hsla)
{
double hue;
double lightness;
double saturation;
double m1, m2;
float hue;
float lightness;
float saturation;
float m1, m2;
lightness = hsla->lightness;
saturation = hsla->saturation;
@ -186,7 +186,7 @@ _gdk_rgba_init_from_hsla (GdkRGBA *rgba,
void
_gtk_hsla_shade (GtkHSLA *dest,
const GtkHSLA *src,
double factor)
float factor)
{
g_return_if_fail (dest != NULL);
g_return_if_fail (src != NULL);

View File

@ -25,17 +25,17 @@ G_BEGIN_DECLS
typedef struct _GtkHSLA GtkHSLA;
struct _GtkHSLA {
double hue;
double saturation;
double lightness;
double alpha;
float hue;
float saturation;
float lightness;
float alpha;
};
void _gtk_hsla_init (GtkHSLA *hsla,
double hue,
double saturation,
double lightness,
double alpha);
float hue,
float saturation,
float lightness,
float alpha);
void _gtk_hsla_init_from_rgba (GtkHSLA *hsla,
const GdkRGBA *rgba);
/* Yes, I can name that function like this! */
@ -44,7 +44,7 @@ void _gdk_rgba_init_from_hsla (GdkRGBA *rgba,
void _gtk_hsla_shade (GtkHSLA *dest,
const GtkHSLA *src,
double factor);
float factor);
G_END_DECLS

View File

@ -49,7 +49,7 @@ l {
}
m {
color: rgb(255,77,77);
color: rgb(255,76,76);
}
n {