diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2012-09-06 12:11:31 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2012-09-06 12:15:28 +0100 |
commit | f67aa36e3b7e7435a19902c95d9ff46954d18993 (patch) | |
tree | 4457149b436013d10976e76611b26208c9a3b98e | |
parent | 44cf976c5171e58873269f89529073bfaca584bd (diff) | |
download | clutter-f67aa36e3b7e7435a19902c95d9ff46954d18993.tar.gz |
color: Simplify shade() implementation
We can use the CLAMP macro, instead of a bunch of ifs.
-rw-r--r-- | clutter/clutter-color.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/clutter/clutter-color.c b/clutter/clutter-color.c index 1f8a11d27..03ffce19e 100644 --- a/clutter/clutter-color.c +++ b/clutter/clutter-color.c @@ -384,17 +384,8 @@ clutter_color_shade (const ClutterColor *color, clutter_color_to_hls (color, &h, &l, &s); - l *= factor; - if (l > 1.0) - l = 1.0; - else if (l < 0) - l = 0; - - s *= factor; - if (s > 1.0) - s = 1.0; - else if (s < 0) - s = 0; + l = CLAMP (l * factor, 0.0, 1.0); + s = CLAMP (s * factor, 0.0, 1.0); clutter_color_from_hls (result, h, l, s); |