Fix for uninitialized results from hsv_to_rgb, when hue is out of range 0..1.

This commit is contained in:
Brecht Van Lommel 2010-07-17 21:01:00 +00:00
parent 84b291462f
commit 2b408cab4e

@ -33,17 +33,14 @@ void hsv_to_rgb(float h, float s, float v, float *r, float *g, float *b)
int i;
float f, p, q, t;
h *= 360.0f;
if(s==0.0f) {
*r = v;
*g = v;
*b = v;
}
else {
if(h== 360.0f) h = 0.0f;
h= (h - floor(h))*6.0f;
h /= 60.0f;
i = (int)floor(h);
f = h - i;
p = v*(1.0f-s);