From 7abcc97c6ab725d0e8e91b459eab371c953dbcdd Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Sat, 20 Apr 2024 21:31:58 +0000 Subject: [PATCH] modules: Swap ColorWheel to HSV float Should resolve #11370 Per Pippin, HSV double is not a valid color model for babl. We need to change to HSV float to resolve the warning when selecting colors on the Color Wheel. --- modules/color-selector-wheel.c | 8 ++++---- modules/gimpcolorwheel.c | 12 ++++++------ modules/gimpcolorwheel.h | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/color-selector-wheel.c b/modules/color-selector-wheel.c index afc1d003f8..9804e79979 100644 --- a/modules/color-selector-wheel.c +++ b/modules/color-selector-wheel.c @@ -147,9 +147,9 @@ colorsel_wheel_set_color (GimpColorSelector *selector, GeglColor *color) { ColorselWheel *wheel = COLORSEL_WHEEL (selector); - gdouble hsv[3]; + gfloat hsv[3]; - gegl_color_get_pixel (color, babl_format_with_space ("HSV double", wheel->format), hsv); + gegl_color_get_pixel (color, babl_format_with_space ("HSV float", wheel->format), hsv); g_signal_handlers_block_by_func (wheel->hsv, G_CALLBACK (colorsel_wheel_changed), wheel); @@ -221,10 +221,10 @@ colorsel_wheel_changed (GimpColorWheel *wheel, GimpColorSelector *selector) { GeglColor *color = gegl_color_new (NULL); - gdouble hsv[3]; + gfloat hsv[3]; gimp_color_wheel_get_color (wheel, &hsv[0], &hsv[1], &hsv[2]); - gegl_color_set_pixel (color, babl_format_with_space ("HSV double", + gegl_color_set_pixel (color, babl_format_with_space ("HSV float", COLORSEL_WHEEL (selector)->format), hsv); gimp_color_selector_set_color (selector, color); diff --git a/modules/gimpcolorwheel.c b/modules/gimpcolorwheel.c index c54113fbbe..6ae0df0c66 100644 --- a/modules/gimpcolorwheel.c +++ b/modules/gimpcolorwheel.c @@ -1341,17 +1341,17 @@ gimp_color_wheel_set_color (GimpColorWheel *wheel, */ void gimp_color_wheel_get_color (GimpColorWheel *wheel, - gdouble *h, - gdouble *s, - gdouble *v) + gfloat *h, + gfloat *s, + gfloat *v) { GimpColorWheelPrivate *priv = gimp_color_wheel_get_instance_private (wheel); g_return_if_fail (GIMP_IS_COLOR_WHEEL (wheel)); - if (h) *h = priv->h; - if (s) *s = priv->s; - if (v) *v = priv->v; + if (h) *h = (gfloat) priv->h; + if (s) *s = (gfloat) priv->s; + if (v) *v = (gfloat) priv->v; } /** diff --git a/modules/gimpcolorwheel.h b/modules/gimpcolorwheel.h index 0e1aeed0ed..b5ebece36d 100644 --- a/modules/gimpcolorwheel.h +++ b/modules/gimpcolorwheel.h @@ -77,9 +77,9 @@ void gimp_color_wheel_set_color (GimpColorWheel *wheel, double s, double v); void gimp_color_wheel_get_color (GimpColorWheel *wheel, - gdouble *h, - gdouble *s, - gdouble *v); + gfloat *h, + gfloat *s, + gfloat *v); void gimp_color_wheel_set_ring_fraction (GimpColorWheel *wheel, gdouble fraction);