diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-21 16:06:44 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-21 16:06:44 +0300 |
commit | 48f48fa814ec08f7c46429af3ebf6c24d65141aa (patch) | |
tree | a62a4051c1a1a5d1808f7ba944ff005517eac6af /source/blender/blenkernel/intern/colortools.c | |
parent | e9b0956b55bfdb6476f3805045d1686fdeaa0c57 (diff) |
Fix crash in histogram in image window when image buffer contains
NaN values, now clamps integer instead of float to prevent this.
Diffstat (limited to 'source/blender/blenkernel/intern/colortools.c')
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index e29d908411c..7bf147b4906 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -882,11 +882,14 @@ void curvemapping_table_RGBA(CurveMapping *cumap, float **array, int *size) DO_INLINE int get_bin_float(float f) { - CLAMP(f, 0.0, 1.0); + int bin= (int)(f*511); + + /* note: clamp integer instead of float to avoid problems with NaN */ + CLAMP(bin, 0, 511); //return (int) (((f + 0.25) / 1.5) * 512); - return (int)(f * 511); + return bin; } |