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

leonardo at ghostscript.com leonardo at ghostscript.com
Wed May 7 02:15:27 PDT 2008


Author: leonardo
Date: 2008-05-07 02:15:27 -0700 (Wed, 07 May 2008)
New Revision: 8710

Modified:
   trunk/gs/src/gxp1fill.c
Log:
Fix (graphics) : Imprecise pattern phase with negative cell origins (continued).

DETAILS :

The old code inaccurately converts floats to integers.
The problem here is that (int)-0.13 == 0 but the math wants -1.
It causes a 1 pixel bias with negative coordinates when argument is not integer.
This isn't a first time when we fix a bug of this kind,
and likely this one is not the last.

This change is important for bug 689579.

Debugged with the following commands :

gswin32c.exe -dMaxBitmap=22000000  -r300 -dNOPAUSE -dBATCH-sDEVICE=ppmraw -sOutputFile=cur-b.ppm 245-07.ps
gswin32c.exe -dMaxBitmap=100000000 -r300 -dNOPAUSE -dBATCH-sDEVICE=ppmraw -sOutputFile=cur-n.ppm 245-07.ps

They must render same raster, but they didn't.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gxp1fill.c
===================================================================
--- trunk/gs/src/gxp1fill.c	2008-05-07 06:25:34 UTC (rev 8709)
+++ trunk/gs/src/gxp1fill.c	2008-05-07 09:15:27 UTC (rev 8710)
@@ -80,9 +80,9 @@
      * tile_by_steps loop, but for simple tiles, we must set it now.
      */
     if (set_mask_phase && m_tile->is_simple) {
-	px = imod(-(int)(m_tile->step_matrix.tx - ptfs->phase.x + 0.5),
+	px = imod(-(int)floor(m_tile->step_matrix.tx - ptfs->phase.x + 0.5),
 		  m_tile->tmask.rep_width);
-	py = imod(-(int)(m_tile->step_matrix.ty - ptfs->phase.y + 0.5),
+	py = imod(-(int)floor(m_tile->step_matrix.ty - ptfs->phase.y + 0.5),
 		  m_tile->tmask.rep_height);
     } else
 	px = py = 0;
@@ -283,10 +283,10 @@
 	return code;
     if (ptile->is_simple && ptile->cdev == NULL) {
 	int px =
-	    imod(-(int)(ptile->step_matrix.tx - state.phase.x + 0.5),
+	    imod(-(int)floor(ptile->step_matrix.tx - state.phase.x + 0.5),
 		 bits->rep_width);
 	int py =
-	    imod(-(int)(ptile->step_matrix.ty - state.phase.y + 0.5),
+	    imod(-(int)floor(ptile->step_matrix.ty - state.phase.y + 0.5),
 		 bits->rep_height);
 
 	if (state.pcdev != dev)



More information about the gs-cvs mailing list