Fix for uninitialized results from hsv_to_rgb, when hue is out of range 0..1.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 17 Jul 2010 21:01:00 +0000 (21:01 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 17 Jul 2010 21:01:00 +0000 (21:01 +0000)
source/blender/blenlib/intern/math_color.c

index 6637d74..396f2c5 100644 (file)
@@ -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 /= 60.0f;
+               h= (h - floor(h))*6.0f;
+
                i = (int)floor(h);
                f = h - i;
                p = v*(1.0f-s);