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

leonardo at ghostscript.com leonardo at ghostscript.com
Tue Dec 12 20:15:29 PST 2006


Author: leonardo
Date: 2006-12-12 20:15:29 -0800 (Tue, 12 Dec 2006)
New Revision: 7501

Modified:
   trunk/gs/src/gxstroke.c
Log:
Fix (stroking) : The CPSI compatibility about the strokepath starting point (continued).

DETAILS :

The last patch allocates an insufficient buffer for gs_join_triangle.
It caused a wrong resiult with PCL.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gxstroke.c
===================================================================
--- trunk/gs/src/gxstroke.c	2006-12-13 01:45:35 UTC (rev 7500)
+++ trunk/gs/src/gxstroke.c	2006-12-13 04:15:29 UTC (rev 7501)
@@ -1142,6 +1142,7 @@
     const gx_line_params *pgs_lp = gs_currentlineparams_inline(pis);
     gs_fixed_point points[8];
     int npoints = 0, initial_cap_points = 0;
+    const int initial_cap_offset = 5; /* gs_join_triangle generates 5 points. */
     int code;
 
     if (plp->thin) {
@@ -1163,11 +1164,11 @@
 	   the initial cap points and store them temporary at the end of array. */
 	int last_point_index; 
 
-	code = cap_points((first == 0 ? pgs_lp->cap : gs_cap_butt), &plp->o, points + 4);
+	code = cap_points((first == 0 ? pgs_lp->cap : gs_cap_butt), &plp->o, points + initial_cap_offset);
 	if (code < 0)
 	    return code;
 	initial_cap_points = code;
-	last_point_index = 4 + initial_cap_points - 1;
+	last_point_index = initial_cap_offset + initial_cap_points - 1;
 	/* Initial moveto. */
 	code = gx_path_add_point(ppath, points[last_point_index].x, points[last_point_index].y);
 	if (code < 0)
@@ -1211,8 +1212,8 @@
 	npoints = 0;
     } else if (initial_cap_points > 1) {
 	/* Skip the last point because closepath below works instead it. */
-	if (npoints < 4)
-	    memcpy(points + npoints, points + 4, sizeof(*points) * (initial_cap_points - 1));
+	if (npoints < initial_cap_offset)
+	    memcpy(points + npoints, points + initial_cap_offset, sizeof(*points) * (initial_cap_points - 1));
 	npoints += initial_cap_points - 1;
     }
     code = add_points(ppath, points, npoints, false);



More information about the gs-cvs mailing list