diff options
Diffstat (limited to 'mate-panel/libpanel-util/panel-color.c')
-rw-r--r-- | mate-panel/libpanel-util/panel-color.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/mate-panel/libpanel-util/panel-color.c b/mate-panel/libpanel-util/panel-color.c index f6148aaa..15ebf686 100644 --- a/mate-panel/libpanel-util/panel-color.c +++ b/mate-panel/libpanel-util/panel-color.c @@ -17,7 +17,6 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b) gdouble green; gdouble blue; gdouble h, l, s; - gdouble delta; red = *r; green = *g; @@ -50,6 +49,8 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b) h = 0; if (max != min) { + gdouble delta; + if (l <= 0.5) s = (max - min) / (max + min); else @@ -84,26 +85,27 @@ rgb_to_hls (gdouble *r, gdouble *g, gdouble *b) static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s) { - gdouble hue; gdouble lightness; gdouble saturation; - gdouble m1, m2; - gdouble r, g, b; lightness = *l; saturation = *s; - if (lightness <= 0.5) - m2 = lightness * (1 + saturation); - else - m2 = lightness + saturation - lightness * saturation; - m1 = 2 * lightness - m2; - if (saturation == 0) { *h = lightness; *l = lightness; *s = lightness; } else { + gdouble hue; + gdouble m1, m2; + gdouble r, g, b; + + if (lightness <= 0.5) + m2 = lightness * (1 + saturation); + else + m2 = lightness + saturation - lightness * saturation; + m1 = 2 * lightness - m2; + hue = *h + 120; while (hue > 360) hue -= 360; |