[clutter] color: Simplify shade() implementation
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] color: Simplify shade() implementation
- Date: Thu, 6 Sep 2012 11:18:27 +0000 (UTC)
commit f67aa36e3b7e7435a19902c95d9ff46954d18993
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Sep 6 12:11:31 2012 +0100
color: Simplify shade() implementation
We can use the CLAMP macro, instead of a bunch of ifs.
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 1f8a11d..03ffce1 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]