[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43258] trunk/blender/source/blender: Fix regressions in the color management / dither patch.

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Jan 10 15:24:19 CET 2012


Revision: 43258
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43258
Author:   blendix
Date:     2012-01-10 14:24:18 +0000 (Tue, 10 Jan 2012)
Log Message:
-----------
Fix regressions in the color management / dither patch.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_utildefines.h
    trunk/blender/source/blender/imbuf/intern/divers.c

Modified: trunk/blender/source/blender/blenlib/BLI_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_utildefines.h	2012-01-10 14:24:02 UTC (rev 43257)
+++ trunk/blender/source/blender/blenlib/BLI_utildefines.h	2012-01-10 14:24:18 UTC (rev 43258)
@@ -108,7 +108,7 @@
 
 #define FTOCHAR(val) ((val)<=0.0f)? 0 : (((val)>(1.0f-0.5f/255.0f))? 255 : (char)((255.0f*(val))+0.5f))
 #define FTOUSHORT(val) ((val >= 1.0f-0.5f/65535)? 65535: (val <= 0.0f)? 0: (unsigned short)(val*65535.0f + 0.5f))
-#define USHORTTOUCHAR(val) ((unsigned char)(((val)+0x80)>>8))
+#define USHORTTOUCHAR(val) ((unsigned char)(((val) >= 65535-128)? 255: ((val)+128)>>8))
 #define F3TOCHAR3(v2, v1) {                                                   \
 		(v1)[0]= FTOCHAR((v2[0]));                                            \
 		(v1)[1]= FTOCHAR((v2[1]));                                            \

Modified: trunk/blender/source/blender/imbuf/intern/divers.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/divers.c	2012-01-10 14:24:02 UTC (rev 43257)
+++ trunk/blender/source/blender/imbuf/intern/divers.c	2012-01-10 14:24:18 UTC (rev 43258)
@@ -188,9 +188,9 @@
 MINLINE void ushort_to_byte_dither_v4(uchar b[4], const unsigned short us[4], DitherContext *di)
 {
 	b[0]= dither_value(us[0], di, 0);
-	b[1]= dither_value(us[0], di, 1);
-	b[2]= dither_value(us[0], di, 2);
-	b[3]= dither_value(us[0], di, 3);
+	b[1]= dither_value(us[1], di, 1);
+	b[2]= dither_value(us[2], di, 2);
+	b[3]= dither_value(us[3], di, 3);
 }
 
 MINLINE void float_to_byte_dither_v4(uchar b[4], const float f[4], DitherContext *di)



More information about the Bf-blender-cvs mailing list