Fix for imagepaint soften tool giving a bit too dark results,
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 17 Oct 2008 13:34:20 +0000 (13:34 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Fri, 17 Oct 2008 13:34:20 +0000 (13:34 +0000)
due to poor float-to-char conversion.

source/blender/src/imagepaint.c

index cc3951f4e902f71ea88029b7cac3cc617c7c224e..149dbf1d0268151f6f1453486260848fe86a1995 100644 (file)
 
 /* Defines and Structs */
 
-#define IMAPAINT_FLOAT_TO_CHAR(f) ((char)(f*255))
 #define IMAPAINT_CHAR_TO_FLOAT(c) (c/255.0f)
 
-#define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f) { c[0]=IMAPAINT_FLOAT_TO_CHAR(f[0]); \
-       c[1]=IMAPAINT_FLOAT_TO_CHAR(f[1]); c[2]=IMAPAINT_FLOAT_TO_CHAR(f[2]); }
+#define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f) { c[0]=FTOCHAR(f[0]); \
+       c[1]=FTOCHAR(f[1]); c[2]=FTOCHAR(f[2]); }
 #define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c) { f[0]=IMAPAINT_CHAR_TO_FLOAT(c[0]); \
        f[1]=IMAPAINT_CHAR_TO_FLOAT(c[1]); f[2]=IMAPAINT_CHAR_TO_FLOAT(c[2]); }
 #define IMAPAINT_FLOAT_RGB_COPY(a, b) VECCOPY(a, b)