summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-01-22 20:50:36 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-01-22 20:50:36 +0000
commit71d78523776db03819e9b6a6b3e44851895ad76a (patch)
tree782ef978c8ba2119aad65ab5691cc8cf4e95052b /src
parentf05e9215cf2b66e2782e9742737920a664902d46 (diff)
downloadlibcss-71d78523776db03819e9b6a6b3e44851895ad76a.tar.gz
libcss-71d78523776db03819e9b6a6b3e44851895ad76a.tar.bz2
Trivial optimisation of HSL->RGB conversion
svn path=/trunk/libcss/; revision=11456
Diffstat (limited to 'src')
-rw-r--r--src/parse/properties/utils.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index 1ecc37c..35882ee 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -303,17 +303,18 @@ static void HSL_to_RGB(css_fixed hue, css_fixed sat, css_fixed lit, uint8_t *r,
* 4 b g
* 5 r g
*
- * Thus, we must only compute the value of the third component
+ * Thus, we need only compute the value of the third component
*/
/* Chroma is the difference between min and max */
chroma = FSUB(max_rgb, min_rgb);
/* Compute which sextant the hue lies in (truncates result) */
- sextant = FIXTOINT(FDIVI(FMULI(hue, 6), 360));
+ hue = FDIVI(FMULI(hue, 6), 360);
+ sextant = FIXTOINT(hue);
/* Compute offset of hue from start of sextant */
- relative_hue = FDIVI(FSUBI(FMULI(hue, 6), sextant * 360), 360);
+ relative_hue = FSUBI(hue, sextant);
/* Scale offset by chroma */
scaled_hue = FMUL(relative_hue, chroma);