diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-07-18 01:01:00 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-07-18 01:01:00 +0400 |
commit | 2b408cab4eb955bcb17efbfa5813ae1b33267f13 (patch) | |
tree | 92f6165aa9943205bfc7f6bbf2cbf1dae5b6a282 /source/blender/blenlib/intern/math_color.c | |
parent | 84b291462fe9023a09c8fd1a418df9ef03cc417d (diff) |
Fix for uninitialized results from hsv_to_rgb, when hue is out of range 0..1.
Diffstat (limited to 'source/blender/blenlib/intern/math_color.c')
-rw-r--r-- | source/blender/blenlib/intern/math_color.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index 6637d74dbb1..396f2c52058 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -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); |