summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/im_converttype.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/im_converttype.cpp b/src/im_converttype.cpp
index c8816ef..0c3d801 100644
--- a/src/im_converttype.cpp
+++ b/src/im_converttype.cpp
@@ -2,7 +2,7 @@
* \brief Image Data Type Conversion
*
* See Copyright Notice in im_lib.h
- * $Id: im_converttype.cpp,v 1.1 2008/10/17 06:10:16 scuri Exp $
+ * $Id: im_converttype.cpp,v 1.2 2008/11/18 20:38:21 scuri Exp $
*/
#include "im.h"
@@ -314,6 +314,9 @@ int iDemoteReal2Int(int count, const float *src_map, DSTT *dst_map, float gamma,
else
value = (*src_map++ - min)/range;
+ if (i==3603)
+ i=i;
+
// Now 0 <= value <= 1 (if min-max are correct)
if (value >= 1)
@@ -323,9 +326,10 @@ int iDemoteReal2Int(int count, const float *src_map, DSTT *dst_map, float gamma,
else
{
value = iGammaFunc(factor, (float)dst_min, gamma, value);
- if (value >= dst_max)
+ int ivalue = imRound(value);
+ if (ivalue >= dst_max)
*dst_map++ = dst_max;
- else if (value <= dst_min)
+ else if (ivalue <= dst_min)
*dst_map++ = dst_min;
else
*dst_map++ = (DSTT)imRound(value - 0.5f);