diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-13 17:53:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-13 17:53:49 +0400 |
commit | 843d8859a718c1f9a8c0f7109b2cdf9bbeb46fa3 (patch) | |
tree | 84832487219a9d9b7b495ade9efb4e7b925cd917 /source/blender/blenlib/intern/math_color.c | |
parent | 62f4d613d06fad1bad95b4ec5e5199425a23d684 (diff) |
bugfix [#23355] Square Color picker moving by itself and locking up
Diffstat (limited to 'source/blender/blenlib/intern/math_color.c')
-rw-r--r-- | source/blender/blenlib/intern/math_color.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index f0ef8b2c93d..09a6b5992db 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -232,6 +232,26 @@ void rgb_to_hsv(float r, float g, float b, float *lh, float *ls, float *lv) *lv = v; } +void rgb_to_hsv_compat(float r, float g, float b, float *lh, float *ls, float *lv) +{ + float orig_h= *lh; + float orig_s= *ls; + + rgb_to_hsv(r, g, b, lh, ls, lv); + + if(*lv <= 0.0f) { + *lh= orig_h; + *ls= orig_s; + } + else if (*ls <= 0.0f) { + *lh= orig_h; + } + + if(*lh==0.0f && orig_h >= 1.0f) { + *lh= 1.0f; + } +} + /*http://brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html */ void xyz_to_rgb(float xc, float yc, float zc, float *r, float *g, float *b, int colorspace) |