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

stefan at ghostscript.com stefan at ghostscript.com
Fri Oct 6 11:53:35 PDT 2006


Author: stefan
Date: 2006-10-06 11:53:35 -0700 (Fri, 06 Oct 2006)
New Revision: 7094

Modified:
   trunk/gs/src/gxstroke.c
Log:
Stepping on Igor's stroke code fully expecting him to review it.
This is the copy of the stroke code Igor originally gave the PCL team.

The code it is replacing loses data and produces stray lines.



Modified: trunk/gs/src/gxstroke.c
===================================================================
--- trunk/gs/src/gxstroke.c	2006-10-06 16:54:37 UTC (rev 7093)
+++ trunk/gs/src/gxstroke.c	2006-10-06 18:53:35 UTC (rev 7094)
@@ -534,7 +534,6 @@
 	fixed y = pseg->pt.y;
 	bool is_closed = ((const subpath *)pseg)->is_closed;
 	partial_line pl, pl_prev, pl_first;
-	bool zero_length = true;
 
 	while ((pseg = pseg->next) != 0 &&
 	       pseg->type != s_start
@@ -558,7 +557,6 @@
 		udy = pd->tangent.y;
 		is_dash_segment = true;
 	    }
-	    zero_length &= ((udx | udy) == 0);
 
 	    pl.o.p.x = x, pl.o.p.y = y;
 	  d:pl.e.p.x = sx, pl.e.p.y = sy;
@@ -583,7 +581,14 @@
 		    if (udx | udy)
 			goto d;
 		}
-		if (pgs_lp->dot_length == 0 && pgs_lp->cap != gs_cap_round && !is_dash_segment) {
+		/*
+		 * The entire subpath is either a dash, or degenerate and includes
+		 * more than one point.  If degenerate and the dot length is non-zero,
+		 * draw the caps, otherwise do nothing.
+		 */
+		if (pgs_lp->dot_length != 0 && !is_dash_segment)
+		    break;
+		if (!dash_count && pgs_lp->cap != gs_cap_round) {
 		    /* From PLRM, stroke operator :
 		       If a subpath is degenerate (consists of a single-point closed path 
 		       or of two or more points at the same coordinates), 
@@ -714,8 +719,7 @@
 		if (!pl.thin) {
 		    adjust_stroke(&pl, pis, false, 
 			    (pseg->prev == 0 || pseg->prev->type == s_start) && 
-			    (pseg->next == 0 || pseg->next->type == s_start) &&
-			    (zero_length || !is_closed));
+			    (pseg->next == 0 || pseg->next->type == s_start));
 		    compute_caps(&pl);
 		}
 	    }
@@ -754,7 +758,7 @@
 	    /* For some reason, the Borland compiler requires the cast */
 	    /* in the following statement. */
 	    pl_ptr lptr =
-		(!is_closed || join == gs_join_none || zero_length ?
+		(!is_closed || join == gs_join_none ?
 		 (pl_ptr) 0 : (pl_ptr) & pl_first);
 
 	    code = (*line_proc) (to_path, index - 1, &pl_prev, lptr, pdevc,



More information about the gs-cvs mailing list