[gs-cvs] rev 7479 - trunk/gs/src

leonardo at ghostscript.com leonardo at ghostscript.com
Fri Dec 8 23:39:00 PST 2006


Author: leonardo
Date: 2006-12-08 23:39:00 -0800 (Fri, 08 Dec 2006)
New Revision: 7479

Modified:
   trunk/gs/src/gxi12bit.c
   trunk/gs/src/gxi16bit.c
Log:
Fix : A wrong 'frac' color comparison caused an incorrect 12 and 16 bpc image rendering.

DETAILS :

Debugged with CET 12-07C.PS page 15 and disassembling gxi12bit.obj .

The old code wrongly computed how many 'long' values are needed to store 4 'frac' values. 
When sizeof(long)==4 and sizeof(short)==2 it gives 1.
However the right answer is 2.
Due to that the old code thinks that 'frac' colors are equal 
when they differ in 3d or 4th component.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gxi12bit.c
===================================================================
--- trunk/gs/src/gxi12bit.c	2006-12-09 06:17:34 UTC (rev 7478)
+++ trunk/gs/src/gxi12bit.c	2006-12-09 07:39:00 UTC (rev 7479)
@@ -128,7 +128,7 @@
     long all[LONGS_PER_COLOR_FRACS];	/* for fast comparison */
 } color_fracs;
 
-#define LONGS_PER_4_FRACS ((FRACS_PER_LONG + 3) / 4)
+#define LONGS_PER_4_FRACS ((arch_sizeof_frac * 4 + arch_sizeof_long - 1) / arch_sizeof_long)
 #if LONGS_PER_4_FRACS == 1
 #  define COLOR_FRACS_4_EQ(f1, f2)\
      ((f1).all[0] == (f2).all[0])

Modified: trunk/gs/src/gxi16bit.c
===================================================================
--- trunk/gs/src/gxi16bit.c	2006-12-09 06:17:34 UTC (rev 7478)
+++ trunk/gs/src/gxi16bit.c	2006-12-09 07:39:00 UTC (rev 7479)
@@ -71,7 +71,7 @@
     long all[LONGS_PER_COLOR_FRACS];	/* for fast comparison */
 } color_fracs;
 
-#define LONGS_PER_4_FRACS ((FRACS_PER_LONG + 3) / 4)
+#define LONGS_PER_4_FRACS ((arch_sizeof_frac * 4 + arch_sizeof_long - 1) / arch_sizeof_long)
 #if LONGS_PER_4_FRACS == 1
 #  define COLOR_FRACS_4_EQ(f1, f2)\
      ((f1).all[0] == (f2).all[0])



More information about the gs-cvs mailing list