[gs-cvs] rev 7212 - trunk/gs/src
leonardo at ghostscript.com
leonardo at ghostscript.com
Sat Nov 18 13:44:31 PST 2006
Author: leonardo
Date: 2006-11-18 13:44:30 -0800 (Sat, 18 Nov 2006)
New Revision: 7212
Modified:
trunk/gs/src/gxfill.c
trunk/gs/src/gxpflat.c
Log:
Fix (filling) : Very long lines were missed sometimes.
DETAILS :
1. The flattening iterator subdivided very long lines into 2 segments
against a fixed overflow. It appears not sufficient due to an
unrelated code optimization. The new code does in 4 segments (gxpflat.c).
See comments in code.
2. When finding a path's Y-minimum, the old code didn't account that
most parts of a segment may fall outside Y-band (gxfill.c).
Debugged with CET 11-11.PS : (next 10 10 moveto 3E9 3E9 lineto fini) .
EXPECTED DIFFERENCES :
None.
Modified: trunk/gs/src/gxfill.c
===================================================================
--- trunk/gs/src/gxfill.c 2006-11-18 01:50:21 UTC (rev 7211)
+++ trunk/gs/src/gxfill.c 2006-11-18 21:44:30 UTC (rev 7212)
@@ -949,11 +949,13 @@
code = init_contour_cursor(ll, &p);
if (code < 0)
return code;
- code = gx_flattened_iterator__next(p.fi);
- if (code < 0)
- return code;
- p.more_flattened = code;
- p.dir = compute_dir(fo, p.fi->ly0, p.fi->ly1);
+ do {
+ code = gx_flattened_iterator__next(p.fi);
+ if (code < 0)
+ return code;
+ p.more_flattened = code;
+ p.dir = compute_dir(fo, p.fi->ly0, p.fi->ly1);
+ } while (p.more_flattened && p.dir == 2);
if (p.fi->ly0 > fo->ymax && ll->y_break > p.fi->ly0)
ll->y_break = p.fi->ly0;
if (p.fi->ly1 > fo->ymax && ll->y_break > p.fi->ly1)
Modified: trunk/gs/src/gxpflat.c
===================================================================
--- trunk/gs/src/gxpflat.c 2006-11-18 01:50:21 UTC (rev 7211)
+++ trunk/gs/src/gxpflat.c 2006-11-18 21:44:30 UTC (rev 7212)
@@ -291,16 +291,27 @@
this->x3 = x1;
this->y3 = y1;
if (ox || oy) {
- /* Subdivide a long line into 2 segments, because the filling algorithm
+ /* Subdivide a long line into 4 segments, because the filling algorithm
and the stroking algorithm need to compute differences
- of coordinates of end points. */
+ of coordinates of end points.
+ We can't use 2 segments, because gx_flattened_iterator__next
+ implements a special code for that case,
+ which requires differences of coordinates as well.
+ */
/* Note : the result of subdivision may be not strongly colinear. */
this->ax = this->bx = 0;
this->ay = this->by = 0;
- this->cx = (ox ? (x1 >> 1) - (x0 >> 1) : (x1 - x0) / 2);
- this->cy = (oy ? (y1 >> 1) - (y0 >> 1) : (y1 - y0) / 2);
- this->k = 1;
- this->i = 2;
+ this->cx = ((ox ? (x1 >> 1) - (x0 >> 1) : (x1 - x0) >> 1) + 1) >> 1;
+ this->cy = ((oy ? (y1 >> 1) - (y0 >> 1) : (y1 - y0) >> 1) + 1) >> 1;
+ this->rd3x = this->rd3y = this->id3x = this->id3y = 0;
+ this->rd2x = this->rd2y = this->id2x = this->id2y = 0;
+ this->idx = this->cx;
+ this->idy = this->cy;
+ this->rdx = this->rdy = 0;
+ this->rx = this->ry = 0;
+ this->rmask = 0;
+ this->k = 2;
+ this->i = 4;
} else {
this->k = 0;
this->i = 1;
More information about the gs-cvs
mailing list