color: Simplify shade() implementation

We can use the CLAMP macro, instead of a bunch of ifs.
This commit is contained in:
Emmanuele Bassi 2012-09-06 12:11:31 +01:00
parent 44cf976c51
commit f67aa36e3b

View File

@ -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);