summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-07-25 00:29:42 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-07-25 11:56:05 -0400
commit706aa93ab5c7999a55bdbd08691cad361669627d (patch)
tree547ae11706adf2ed1bfec46e720b073fbeb2091f
parent54deed9a5a318fd7f05747a05f66d66b144ad71a (diff)
downloadgtk+-706aa93ab5c7999a55bdbd08691cad361669627d.tar.gz
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.
-rw-r--r--gtk/gtkhsla.c30
-rw-r--r--gtk/gtkhslaprivate.h18
-rw-r--r--testsuite/css/parser/color.ref.css2
3 files changed, 25 insertions, 25 deletions
diff --git a/gtk/gtkhsla.c b/gtk/gtkhsla.c
index abb4aaf689..9692e3e59f 100644
--- a/gtk/gtkhsla.c
+++ b/gtk/gtkhsla.c
@@ -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);
diff --git a/gtk/gtkhslaprivate.h b/gtk/gtkhslaprivate.h
index 9f038cce25..145daf7461 100644
--- a/gtk/gtkhslaprivate.h
+++ b/gtk/gtkhslaprivate.h
@@ -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
diff --git a/testsuite/css/parser/color.ref.css b/testsuite/css/parser/color.ref.css
index 2241017d32..780d21c565 100644
--- a/testsuite/css/parser/color.ref.css
+++ b/testsuite/css/parser/color.ref.css
@@ -49,7 +49,7 @@ l {
}
m {
- color: rgb(255,77,77);
+ color: rgb(255,76,76);
}
n {