Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2010-01-21 16:06:44 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2010-01-21 16:06:44 +0300
commit48f48fa814ec08f7c46429af3ebf6c24d65141aa (patch)
treea62a4051c1a1a5d1808f7ba944ff005517eac6af /source/blender/blenkernel/intern/colortools.c
parente9b0956b55bfdb6476f3805045d1686fdeaa0c57 (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.c7
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;
}