summaryrefslogtreecommitdiff
path: root/mate-panel/libpanel-util/panel-color.c
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2023-11-15 15:10:11 +0100
committerraveit65 <[email protected]>2024-02-04 18:37:58 +0100
commit62fabfc793b545250dafaf37f75650cbfdce095f (patch)
tree813bd86b3926f24be1f17a1830f2f3d65fd4ec8a /mate-panel/libpanel-util/panel-color.c
parentf98be9734446e1b620312b69dc8fa8ed0f0997d9 (diff)
downloadmate-panel-62fabfc793b545250dafaf37f75650cbfdce095f.tar.bz2
mate-panel-62fabfc793b545250dafaf37f75650cbfdce095f.tar.xz
Reduce scope of variables
Mostly found by cppcheck. origin commit was: https://github.com/mate-desktop/mate-panel/commit/96c7ebc
Diffstat (limited to 'mate-panel/libpanel-util/panel-color.c')
-rw-r--r--mate-panel/libpanel-util/panel-color.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mate-panel/libpanel-util/panel-color.c b/mate-panel/libpanel-util/panel-color.c
index f6148aaa..661e6fb5 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,11 +85,9 @@ 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;
@@ -104,6 +103,9 @@ hls_to_rgb (gdouble *h, gdouble *l, gdouble *s)
*l = lightness;
*s = lightness;
} else {
+ gdouble hue;
+ gdouble r, g, b;
+
hue = *h + 120;
while (hue > 360)
hue -= 360;