[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26166] trunk/blender/source/blender/ blenkernel/intern/colortools.c: Fix crash in histogram in image window when image buffer contains
Brecht Van Lommel
brecht at blender.org
Thu Jan 21 14:06:45 CET 2010
Revision: 26166
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26166
Author: blendix
Date: 2010-01-21 14:06:44 +0100 (Thu, 21 Jan 2010)
Log Message:
-----------
Fix crash in histogram in image window when image buffer contains
NaN values, now clamps integer instead of float to prevent this.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/colortools.c
Modified: trunk/blender/source/blender/blenkernel/intern/colortools.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/colortools.c 2010-01-21 12:07:15 UTC (rev 26165)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c 2010-01-21 13:06:44 UTC (rev 26166)
@@ -882,11 +882,14 @@
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;
}
More information about the Bf-blender-cvs
mailing list