[gs-cvs] rev 7096 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Tue Oct 10 11:00:20 PDT 2006
Author: leonardo
Date: 2006-10-10 11:00:19 -0700 (Tue, 10 Oct 2006)
New Revision: 7096
Modified:
trunk/gs/src/gxpdash.c
trunk/gs/src/gxstroke.c
trunk/gs/src/lib.mak
Log:
Fix (stroking) : Zero lengh dashes have been missed, part 2.
DETAILS :
1. Unwinding the revision 7094 change.
2. Fixing an antique bug, which persists since the repository was created.
When computing the orientation of an isolated zero length stroke
(near the code "const segment *end = psub->last;"),
the old code erroneusely takes the direction to
the last point of the previous subpath.
With recent changes it caused a wrong longitude adjustment
for some PCL documents.
Documented the right invariant in new comment.
3. The flag zero_length was wrong when a non-zero
length segment follows a zero length segment.
4. Zero length strokes were missed with dot_length != 0
and a non-trivial dash pattern (gxpdash.c, lib.mak).
It's another case when PCL could miss dots.
EXPECTED DIFFERENCES :
PS ppmraw 300 dpi :
motor.pdf
PS ppmraw 72 dpi :
None.
PS pdfwrite 300 dpi :
motor.pdf
PS pdfwrite 72 dpi :
None.
PCL ppmraw 216 dpi :
"pcl\pcl5ccet\18-01.BIN"
"pcl\pcl5ccet\20-05.BIN"
"pcl\pcl5ccet\27-01.BIN"
"pcl\pcl5ccet\28-01.BIN"
"pcl\pcl5ccet\28-02.BIN"
"pcl\pcl5ccet\28-03.BIN"
"pcl\pcl5ccet\28-04.BIN"
"pcl\pcl5ccet\28-05.BIN"
"pcl\pcl5ccet\28-06.BIN"
"pcl\pcl5ccet\28-07.BIN"
"pcl\pcl5ccet\28-08.BIN"
"pcl\pcl5ccet\28-09.BIN"
"pcl\pcl5ccet\28-10.BIN"
"pcl\pcl5ccet\29-05.BIN"
"pcl\pcl5ccet\29-06.BIN"
"pcl\pcl5ccet\29-07.BIN"
"pcl\pcl5ccet\29-08.BIN"
"pcl\pcl5ccet\29-09.BIN"
"pcl\pcl5ccet\29-10.BIN"
"pcl\pcl5ccet\29-11.BIN"
"pcl\pcl5ccet\30-01.BIN"
"pcl\pcl5ccet\30-19.BIN"
"pcl\pcl5ccet\30-23.BIN"
"pcl\pcl5ccet\31-01.BIN"
"pcl\pcl5ccet\31-02.BIN"
"pcl\pcl5ccet\31-03.BIN"
"pcl\pcl5ccet\31-04.BIN"
"pcl\pcl5ccet\31-05.BIN"
"pcl\pcl5ccet\31-06.BIN"
"pcl\pcl5ccet\31-07.BIN"
"pcl\pcl5ccet\31-08.BIN"
"pcl\pcl5ccet\31-09.BIN"
"pcl\pcl5ccet\31-11.BIN"
"pcl\pcl5ccet\32-01.BIN"
"pcl\pcl5ccet\32-02.BIN"
"pcl\pcl5ccet\32-03.BIN"
"pcl\pcl5ccet\32-04.BIN"
"pcl\pcl5ccet\32-05.BIN"
"pcl\pcl5ccet\32-06.BIN"
"pcl\pcl5ccet\32-07.BIN"
"pcl\pcl5ccet\33-01.BIN"
"pcl\pcl5ccet\34-03.BIN"
"pcl\pcl5ccet\34-04.BIN"
"pcl\pcl5ccet\35-02.BIN"
"pcl\pcl5ccet\35-03.BIN"
"pcl\pcl5ccet\35-05.BIN"
"pcl\pcl5ccet\35-06.BIN"
"pcl\pcl5ccet\35-09.BIN"
"pcl\pcl5ccet\36-04.BIN"
"pcl\pcl5ccet\36-05.BIN"
"pcl\pcl5cfts\fts.0982"
"pcl\pcl5cfts\fts.1230"
"pcl\pcl5cfts\fts.1270"
"pcl\pcl5cfts\fts.1280"
"pcl\pcl5cfts\fts.1290"
"pcl\pcl5cfts\fts.1300"
"pcl\pcl5cfts\fts.1320"
"pcl\pcl5cfts\fts.1330"
"pcl\pcl5cfts\fts.1340"
"pcl\pcl5cfts\fts.1460"
"pcl\pcl5cfts\fts.1552"
"pcl\pcl5cfts\fts.1640"
"pcl\pcl5cfts\fts.1832"
"pcl\pcl5cfts\fts.1850"
"pcl\pcl5cfts\fts.1924"
"pcl\pcl5cfts\fts.1934"
"pcl\pcl5cfts\fts.1965"
"pcl\pcl5cfts\fts.2114"
"pcl\pcl5cfts\fts.2201"
"pcl\pcl5cfts\fts.2210a"
"pcl\pcl5cfts\fts.2210e"
"xl\pcl6cet3.0\E000.bin"
Modified: trunk/gs/src/gxpdash.c
===================================================================
--- trunk/gs/src/gxpdash.c 2006-10-10 10:03:37 UTC (rev 7095)
+++ trunk/gs/src/gxpdash.c 2006-10-10 18:00:19 UTC (rev 7096)
@@ -19,6 +19,7 @@
#include "gscoord.h"
#include "gxfixed.h"
#include "gxarith.h"
+#include "gxistate.h"
#include "gsline.h"
#include "gzline.h"
#include "gzpath.h"
@@ -59,6 +60,7 @@
int wrap = (dash->init_ink_on && psub->is_closed ? -1 : 0);
int drawing = wrap;
segment_notes notes = ~sn_not_first;
+ const gx_line_params *pgs_lp = gs_currentlineparams_inline(pis);
int code;
if ((code = gx_path_add_point(ppath, x0, y0)) < 0)
@@ -83,7 +85,8 @@
double left;
if (!(udx | udy)) { /* degenerate */
- if (gs_currentlinecap((const gs_state *)pis) != gs_cap_round) {
+ if (pgs_lp->dot_length == 0 &&
+ 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),
Modified: trunk/gs/src/gxstroke.c
===================================================================
--- trunk/gs/src/gxstroke.c 2006-10-10 10:03:37 UTC (rev 7095)
+++ trunk/gs/src/gxstroke.c 2006-10-10 18:00:19 UTC (rev 7096)
@@ -534,6 +534,7 @@
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
@@ -557,7 +558,7 @@
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;
if (!(udx | udy) || pseg->type == s_dash) { /* degenerate or short */
@@ -578,17 +579,12 @@
goto d1;
sx = pseg->pt.x, udx = sx - x;
sy = pseg->pt.y, udy = sy - y;
- if (udx | udy)
+ if (udx | udy) {
+ zero_length = false;
goto d;
+ }
}
- /*
- * 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) {
+ if (pgs_lp->dot_length == 0 && pgs_lp->cap != gs_cap_round && !is_dash_segment) {
/* 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),
@@ -602,16 +598,16 @@
* according to the specified dot orientation.
*/
{
- const segment *end = psub->prev;
+ /* When passing here, either pseg == NULL or it points to the
+ start of the next subpaph. So we can't use pseg
+ for determining the segment direction.
+ In same time, psub->last may help, so use it. */
+ const segment *end = psub->last;
if (is_dash_segment) {
/* Nothing. */
} else if (end != 0 && (end->pt.x != x || end->pt.y != y))
sx = end->pt.x, sy = end->pt.y, udx = sx - x, udy = sy - y;
- else if (pseg != 0 &&
- (pseg->pt.x != x || pseg->pt.y != y)
- )
- sx = pseg->pt.x, sy = pseg->pt.y, udx = sx - x, udy = sy - y;
}
/*
* Compute the properly oriented dot length, and then
@@ -719,7 +715,8 @@
if (!pl.thin) {
adjust_stroke(&pl, pis, false,
(pseg->prev == 0 || pseg->prev->type == s_start) &&
- (pseg->next == 0 || pseg->next->type == s_start));
+ (pseg->next == 0 || pseg->next->type == s_start) &&
+ (zero_length || !is_closed));
compute_caps(&pl);
}
}
@@ -758,7 +755,7 @@
/* For some reason, the Borland compiler requires the cast */
/* in the following statement. */
pl_ptr lptr =
- (!is_closed || join == gs_join_none ?
+ (!is_closed || join == gs_join_none || zero_length ?
(pl_ptr) 0 : (pl_ptr) & pl_first);
code = (*line_proc) (to_path, index - 1, &pl_prev, lptr, pdevc,
Modified: trunk/gs/src/lib.mak
===================================================================
--- trunk/gs/src/lib.mak 2006-10-10 10:03:37 UTC (rev 7095)
+++ trunk/gs/src/lib.mak 2006-10-10 18:00:19 UTC (rev 7096)
@@ -693,7 +693,7 @@
$(GLOBJ)gxpdash.$(OBJ) : $(GLSRC)gxpdash.c $(GX) $(math__h)\
$(gscoord_h) $(gsline_h) $(gsmatrix_h)\
- $(gxfixed_h) $(gzline_h) $(gzpath_h)
+ $(gxfixed_h) $(gxpdash_h) $(gzline_h) $(gzpath_h)
$(GLCC) $(GLO_)gxpdash.$(OBJ) $(C_) $(GLSRC)gxpdash.c
$(GLOBJ)gxpflat.$(OBJ) : $(GLSRC)gxpflat.c $(GX)\
More information about the gs-cvs
mailing list