summaryrefslogtreecommitdiff
path: root/mate-panel
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2023-11-15 15:39:56 +0100
committerLuke from DC <[email protected]>2023-11-21 20:19:58 +0000
commit655a8f484598a07a210dc56f1662021f8be69737 (patch)
tree8ee52422a225a590dcee05013c0b926fc72ec995 /mate-panel
parent6a3df1342b957f0293c7a9f05b3037dff3156487 (diff)
downloadmate-panel-655a8f484598a07a210dc56f1662021f8be69737.tar.bz2
mate-panel-655a8f484598a07a210dc56f1662021f8be69737.tar.xz
Reduce scope of more code
The computed values are only used in one branch, so compute them there.
Diffstat (limited to 'mate-panel')
-rw-r--r--mate-panel/libpanel-util/panel-color.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/mate-panel/libpanel-util/panel-color.c b/mate-panel/libpanel-util/panel-color.c
index 661e6fb5..15ebf686 100644
--- a/mate-panel/libpanel-util/panel-color.c
+++ b/mate-panel/libpanel-util/panel-color.c
@@ -87,25 +87,25 @@ hls_to_rgb (gdouble *h, gdouble *l, gdouble *s)
{
gdouble lightness;
gdouble saturation;
- gdouble m1, m2;
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;