[gs-cvs] rev 7617 - in trunk/gs: doc src
leonardo at ghostscript.com
leonardo at ghostscript.com
Thu Jan 18 12:25:30 PST 2007
Author: leonardo
Date: 2007-01-18 12:25:30 -0800 (Thu, 18 Jan 2007)
New Revision: 7617
Modified:
trunk/gs/doc/pscet_status.txt
trunk/gs/src/gxstroke.c
Log:
Provide the CPSI compatibility for strokepath.
DETAILS :
This is 1st of 2 closely related changes to gxstroke.c .
It changes behavior in the CPSI compatibility mode only.
The main workers are stroke_add_compat, stroke_add_initial_cap_compat.
The strokepath contours are always positive rather some
older CPSI versions generate negative ones in some circumstances.
We believe that positive contours only is the correct behavior,
because it complies with other contours such as arcs or
character outlines. Otherwise non-zero winding rule filling
gives an unexpected result when combining various paths in a
single path.
EXPECTED DIFFERENCES :
Without gs_cet.ps - no differences.
Modified: trunk/gs/doc/pscet_status.txt
===================================================================
--- trunk/gs/doc/pscet_status.txt 2007-01-17 21:10:47 UTC (rev 7616)
+++ trunk/gs/doc/pscet_status.txt 2007-01-18 20:25:30 UTC (rev 7617)
@@ -247,7 +247,7 @@
09-24-1 OK
-09-24-2 OK Fixed by rev 7563.
+09-24-2 OK Fixed by rev 7617.
09-24-3 OK Fixed by r7123.
@@ -255,7 +255,7 @@
09-25-1 OK
-09-25-2 OK Fixed by rev 7563.
+09-25-2 OK Fixed by rev 7617.
09-25-3 OK Fixed by r7123.
@@ -263,7 +263,7 @@
09-26-1 OK Minor differences visually reviewed by RJJ
-09-26-2 OK Fixed by rev 7563.
+09-26-2 OK Fixed by rev 7617.
09-26-3 OK Fixed by r7123. Color corrected by rev 7172.
@@ -274,7 +274,7 @@
09-27-2 OK Minor differences visually reviewed by RJJ
-09-27-3 OK Fixed by rev 7563.
+09-27-3 OK Fixed by rev 7617.
09-27-4 OK Fixed by r7123. Color corrected by rev 7172.
@@ -286,7 +286,7 @@
09-28-2 OK Fixed as of rev. 7211
cpsi/09-28-2 missing. Acrobat 7 output obtained.
-09-28-3 OK Fixed by rev 7563.
+09-28-3 OK Fixed by rev 7617.
cpsi/09-28-3 missing. Acrobat 7 output obtained.
09-28-4 OK Imagemask -- Fixed by r7123. Tek and AD7 output differ.
@@ -300,7 +300,7 @@
forced to /DeviceCMY. DeviceRGB values fixed in rev. 7216
cpsi/09-29-1 missing
-09-29-2 OK Fixed by rev 7563.
+09-29-2 OK Fixed by rev 7617.
cpsi/09-29-2 missing
09-29-3 OK Imagemask -- Fixed by r7123. Tek and AD7 output differ.
@@ -314,7 +314,7 @@
09-30-2 OK Error reports are fixed in rev. 7138. - Alex
-09-30-3 OK Colors corrected by rev 7172. Fixed by rev 7563.
+09-30-3 OK Colors corrected by rev 7172. Fixed by rev 7617.
09-30-4 OK Fixed by r7123. Color corrected by rev 7172.
@@ -346,7 +346,7 @@
09-31-7 OK Matches Tek hardcopy output. RJJ
cpsi/09-31-7 missing. Acrobat 7 output obtained.
-09-31-8 OK Fixed by rev 7563.
+09-31-8 OK Fixed by rev 7617.
cpsi/09-31-8 missing. Acrobat 7 output obtained.
09-31-9 OK Matches Tek hardcopy output. RJJ
@@ -358,7 +358,7 @@
09-32-2 OK Error codes are adjusted to match the checksum. rev. 7167 - Alex
cpsi/09-32-2 missing. Acrobat 7 output obtained.
-09-32-3 OK Fixed by rev 7563.
+09-32-3 OK Fixed by rev 7617.
cpsi/09-32-3 missing. Acrobat 7 output obtained.
09-32-4 OK Matches Tek hardcopy output. RJJ
@@ -371,7 +371,7 @@
09-33-2 OK Matches Tek hardcopy output. RJJ
-09-33-3 OK Fixed by rev 7563.
+09-33-3 OK Fixed by rev 7617.
09-33-4 OK Fixed by r7123. Color corrected by rev 7172.
@@ -429,7 +429,7 @@
'missing' graphics then appear.
cpsi/09-34-16 missing
-09-34-17 OK Fixed by rev 7563.
+09-34-17 OK Fixed by rev 7617.
cpsi/09-34-17 missing
09-34-18 OK Fixed by r7123.
@@ -498,7 +498,7 @@
09-35-1 OK Matches Tek hardcopy output. RJJ
09-35-2 OK Color difference (cmpi -c25 is OK, -c24 detects all pixels differ),
- otherwise fixed by rev 7563.
+ otherwise fixed by rev 7617.
Presumed to match Tek (different inks, etc.) since this test uses
'setcolortransfer' which is ignored by CPSI. RJJ
@@ -533,8 +533,8 @@
assign: Raph.
09-36-5 DIFF In "Technical Paths", Ghostscript differs a lot, combination
- of 09-24-2 linecap linejoin issues and dash issues. Defer
- this until after 09-24-2 is addressed. Assign: Ray
+ of 09-24-2 linecap linejoin issues and dash issues.
+ assign: Igor
09-36-6 OK Fixed by r7123.
@@ -595,7 +595,7 @@
09-38-1 OK Minor differences visually reviewed by RJJ
-09-38-2 OK Fixed by rev 7563.
+09-38-2 OK Fixed by rev 7617.
09-38-3 OK Fixed by r7123.
@@ -604,7 +604,7 @@
09-39-1 OK Matches Tek hardcopy output. RJJ
cpsi/09-39-1 missing
-09-39-2 AOK Fixed by rev 7563. GS is contone, Tek is dithered with coarse pattern.
+09-39-2 AOK Fixed by rev 7617. GS is contone, Tek is dithered with coarse pattern.
cpsi/09-39-2 missing.
09-39-3 AOK GS is contone, Tek is dithered with coarse pattern. GS with 4-bit
@@ -647,7 +647,7 @@
09-40-22 OK
-09-40-23 OK Fixed by rev 7563.
+09-40-23 OK Fixed by rev 7617.
09-40-24 OK Fixed by r7123. Color corrected by rev 7172.
@@ -669,7 +669,7 @@
09-41-1 OK
-09-41-2 OK Fixed by rev 7563.
+09-41-2 OK Fixed by rev 7617.
09-41-3 OK Fixed by r7123.
@@ -683,7 +683,7 @@
09-42-4 OK
-09-42-5 OK Fixed by rev 7563.
+09-42-5 OK Fixed by rev 7617.
09-42-6 OK Fixed by r7123.
@@ -697,7 +697,7 @@
09-43-4 OK
-09-43-5 OK Fixed by rev 7563.
+09-43-5 OK Fixed by rev 7617.
09-43-6 OK Fixed by r7123.
@@ -711,7 +711,7 @@
09-44-4 OK
-09-44-5 OK Fixed by rev 7563.
+09-44-5 OK Fixed by rev 7617.
09-44-6 OK Fixed by r7123.
@@ -728,7 +728,7 @@
09-45-4 OK
-09-45-5 DIFF Partly fixed by rev 7563. Remaining diff is width of miter
+09-45-5 DIFF Partly fixed by rev 7617. Remaining diff is width of miter
extension in "Stroked Objects". Assign: Ray
09-45-6 OK Fixed by r7123.
@@ -1181,7 +1181,7 @@
09-48-1 OK Fixed in rev. 7138 - Alex
-09-48-2 OK Fixed by rev 7563.
+09-48-2 OK Fixed by rev 7617.
09-48-3 OK Fixed by r7123.
@@ -1199,7 +1199,7 @@
09-49C-1 OK Matches Tek hardcopy and checksum. RJJ (CPSI differs because it
ignores setscreen).
-09-49D-1 OK Fixed by rev 7563.
+09-49D-1 OK Fixed by rev 7617.
09-49D-2 OK Fixed by r7123. Color corrected by rev 7172.
@@ -1220,7 +1220,7 @@
09-51-1 OK Matches Tek hardcopy. RJJ (CPSI ignores settransfer).
-09-51-2 OK Fiexd by rev 7563. GS matches colors of Tek hardcopy, CPSI
+09-51-2 OK Fiexd by rev 7617. GS matches colors of Tek hardcopy, CPSI
shows MUCH different colors.
09-51-3 OK Fixed by r7123. GS matches colors of Tek hardcopy, CPSI
@@ -1232,7 +1232,7 @@
09-52-1 AOK Device Dependent: GS has default ProcessColorModel /DeviceRGB
CPSI has /DeviceN, Tek has /DeviceCMY (not a standard one??)
-09-52-2 OK Fixed by rev 7563.
+09-52-2 OK Fixed by rev 7617.
09-52-3 OK Fixed by r7123.
@@ -1248,7 +1248,7 @@
to cliprestore.
Fixed by r7155 - Raph
-09-53-5 OK Fixed by rev 7563.
+09-53-5 OK Fixed by rev 7617.
09-53-6 OK Fixed by r7123. Color corrected by rev 7172.
@@ -1265,7 +1265,7 @@
09-54-5 OK Fixed in r7155 - Raph
-09-54-6 OK Fixed by rev 7563.
+09-54-6 OK Fixed by rev 7617.
assign: Ray
09-54-7 OK Fixed by r7123. Color corrected by rev 7172.
@@ -1301,7 +1301,7 @@
09-57-13 AOK Test 09-12: With bad smoothness CPSI shadings are worse.
Analyzed by Igor.
-09-57-14 OK Fixed by rev 7563.
+09-57-14 OK Fixed by rev 7617.
09-57-15 OK Fixed by r7123.
@@ -1542,7 +1542,12 @@
11-01-5 OK
-11-01-6 OK Matches Tek hardcopy and 'fixed' CPSI output. RJJ
+11-01-6 AOK rev 7617 : look30, much34 look like a saw due to "strokepath stroke".
+ CPSI and GS rev 7617 generate individual contours for line joins,
+ which look like a quadrangle with a very acute corner.
+ Then it's a subject of miter limit, which depends on the angle,
+ which depends on the flattening factor of the original curve.
+ With CPSI look30 has a smaller number of peaks.
11-02-1 DIFF gs_arc_add_inline sets current point from fixed point coords in
path. Need to implement PRECISE_CURRENTPOINT logic here. - assign Raph
@@ -1556,7 +1561,7 @@
11-02-5 OK
-11-02-6 OK Matches Tek hardcopy and 'fixed' CPSI output. RJJ
+11-02-6 AOK Same as 11-01-6.
11-03-1 OK Minor differences visually reviewed by RJJ
@@ -1570,7 +1575,7 @@
11-03-6 OK Minor differences visually reviewed by RJJ
-11-03-7 OK Matches Tek hardcopy and 'fixed' CPSI output. RJJ
+11-03-7 AOK Same as 11-01-6.
11-04-1 OK Minor differences visually reviewed by RJJ
@@ -1584,7 +1589,7 @@
11-04-6 OK Minor differences visually reviewed by RJJ
-11-04-7 OK Matches Tek hardcopy and 'fixed' CPSI output. RJJ
+11-04-7 AOK Same as 11-01-6.
11-05-1 OK Minor differences visually reviewed by RJJ
@@ -1598,7 +1603,7 @@
11-05-6 OK fixed in r7228 - Raph
-11-05-7 OK Minor differences visually reviewed by HAS. Color corrected by rev 7172.
+11-05-7 AOK Same as 11-01-6. Color corrected by rev 7172.
11-06-1 OK Minor differences visually reviewed by RJJ
@@ -1619,7 +1624,7 @@
11-07-4 OK Minor differences visually reviewed by RJJ
-11-07-5 OK Fixed by rev 7563.
+11-07-5 OK Fixed by rev 7617.
11-08-1 OK Minor differences visually reviewed by RJJ
@@ -1661,30 +1666,10 @@
11-09-7 OK
-11-09-8 DIFF Stroking problems;
- Analyzed by Igor.
+11-09-8 AOK look30, much34 : AOK same as 11-01-6.
-
- look22: diff - different miter.
- the path is 0 0 moveto 5 30 10 0 15 50 curveto 0 0 7 270 360 arc
- The miter join happens between the curve and the straight line to the arc.
- This angle's tangent is -(5.*37-30.*15)/(5.*15+30.*37) = 0.22362869198312235
- Due to the curve flattening with 32 segments it becomes
- -(988.*186-1050.*400)/(988*1050+400*186) = 0.2124770642201834
- The miter limit tangent is 0.20305866
- When I force a flattening with 15 segments, the tangent becomes smaller
- and the meter isn't painted.
- Thus I think the problem reduces to a different flattening,
- which is same as 09-47N-1.
- assign: Ray.
- -
- look30: aok - A CPSI graphic glitch.
- -
- cash24, more24 : diff - same as 11-09-4 assign: Raph.
- -
more21: aok - CPSI appears ignoring the bad flattening precision.
May be related to 11-09-4 assign: Ray.
- -
- much34: aok - CPSI graphic glitch.
11-10-1 AOK Test measures number of subdivisions with different values of
setflat. Differences are expected (resolution dependent). -Raph
@@ -1699,7 +1684,7 @@
11-10-5 DIFF same as 11-10-4 assign: Raph.
Same as 11-10-4
-11-10-6 OK Minor differences visually reviewed by HAS
+11-10-6 AOK look30, much34 : AOK same as 11-01-6.
11-11-1 OK Fixed with rev 7212.
@@ -1773,7 +1758,7 @@
11-16-7 OK
-11-16-8 OK Minor differences visually reviewed by HAS
+11-16-8 AOK look30, much34 : AOK same as 11-01-6.
11-17-1 OK Fixed as of rev 7598.
@@ -1809,8 +1794,7 @@
11-19-5 OK Minor differences visually reviewed by RJJ
-11-19-6 DIFF missing 4's in the look and much column similar to 11-08-5
- upath problems - assign Raph
+11-19-6 DIFF cash21, look30 : path ending point, assign: Igor.
11-20-1 OK Minor differences visually reviewed by HAS
@@ -1882,7 +1866,7 @@
11-21-2 OK Minor differences visually reviewed by RJJ
-11-21-3 OK Fixed by rev 7563.
+11-21-3 OK Fixed by rev 7617.
11-21-4 DIFF Analyzed by Igor.
There are several stroking problems.
@@ -1899,6 +1883,8 @@
11-21-6 AOK Resolution dependent: GS gives pathbox exact (not enlarged
slightly). Tek and CPSI differ.
+ -
+ curve saw : AOK - same as 11-01-6.
11-21-7 DIFF GS gives "F" instead of "T" for "{ 10 10 moveto strokepath
currentpoint moveto } stopped". Tek matches CPSI
@@ -1907,7 +1893,7 @@
11-21-8 AOK Device Dependent / Resolution Dependent. CPSI ignores setflat
Tek and CPSI differ.
-11-21-9 AOK similar to issues in 11-21-8. Tek and CPSI differ.
+11-21-9 AOK flattness differ. Tek and CPSI differ.
11-22-1 OK
@@ -1932,7 +1918,7 @@
11-22-7 OK fixed in r7228 - Raph
-11-22-8 OK
+11-22-8 AOK curve saw : AOK - same as 11-01-6.
11-23-1 AOK GS (apparently) does not implement upath caching. Tek and CPSI
do, but differ. Device Dependent (as comment says).
@@ -2022,9 +2008,9 @@
11-28-12 AOK same as 11-21-10.
-11-28-2 OK Fixed by rev 7563.
+11-28-2 OK Fixed by rev 7617.
-11-28-3 DIFF Some elements are in the wrong place with GS. assign: Ray
+11-28-3 AOK curve saw : AOK - same as 11-01-6.
11-28-4 AOK CPSI stroking problem. CPSI and Tek differ.
@@ -2772,11 +2758,11 @@
13-01-6 OK Minor differences visually reviewed by HAS
-13-01-7 DIFF Same as 13-20-6 - strokepath - Assign: Igor.
+13-01-7 OK rev 7617.
13-02-1 OK Minor differences visually reviewed by RJJ
-13-02-10 DIFF Same as 13-20-6 - strokepath - Assign: Igor.
+13-02-10 OK rev 7617.
13-02-2 OK Minor differences visually reviewed by RJJ
@@ -2815,7 +2801,7 @@
13-03-8 DIFF gs has an extra 2 in column 1 and 7. Squinting
x's overwrite o's row 1 col. 30 and a few other places
best to look at a digital diff.
- assign Igor.
+ assign: Igor.
13-04-1 AOK Analyzed by Igor.
CPSI prints an incomplete page.
@@ -2875,13 +2861,13 @@
13-10-8 OK Minor differences visually reviewed by HAS. Color corrected by rev 7172.
-13-10-9 DIFF Same as 13-20-6 - strokepath - Assign: Igor.
+13-10-9 OK rev 7617.
13-11-1 OK
13-12-1 OK
-13-12-10 DIFF Same as 13-20-6 - strokepath - Assign: Igor.
+13-12-10 OK rev 7617.
13-12-2 OK
@@ -2921,7 +2907,7 @@
13-13-7 OK
-13-13-8 OK Color corrected by rev 7172. Fixed by rev 7563.
+13-13-8 OK Color corrected by rev 7172. Fixed by rev 7617.
13-14-1 AOK same as 13-04-1
@@ -2962,7 +2948,7 @@
a number of operatord. IMHO this can be AOK
assign Raph
-13-16-9 DIFF Same as 13-20-6 - strokepath - Assign: Igor.
+13-16-9 OK rev 7617.
13-17-1 OK Corrected by 7152 and 7162. ADC
@@ -2978,13 +2964,13 @@
13-17-7 OK Minor differences in positions and character shapes - ADC
-13-17-8 DIFF Same as 13-20-6 - strokepath - Assign: Igor.
+13-17-8 OK rev 7617.
13-18-1 OK
13-18-10 OK Minor differences in positions and character shapes - ADC
-13-18-11 DIFF Same as 13-20-6 - strokepath - Assign: Igor.
+13-18-11 OK rev 7617.
13-18-2 OK
@@ -3014,7 +3000,7 @@
13-19-6 OK Minor differences in positions and character shapes - ADC
-13-19-7 DIFF Same as 13-20-6 - strokepath - Assign: Igor.
+13-19-7 OK rev 7617.
13-20-1 OK Minor differences in positions and character shapes - ADC
@@ -3027,13 +3013,7 @@
13-20-5 OK Corrected by 7152 and 7162. ADC
-13-20-6 DIFF cash25 : The placement of "GENOA" depends on
- the 'strokepath' ending point.
- CPSI generates more contours for 'strokepath',
- so Ghostscript ending point can't be same
- while it does lesser contours,
- because the starting point was fixed for other CET tests.
- Assign: Igor.
+13-20-6 OK rev 7617.
13-21-1 DIFF CPSI indicates [F] for ( SharedFontDirectory xcheck). GS
indicates [T]. - ADC
@@ -3049,7 +3029,7 @@
13-22-5 OK Color corrected by rev 7172.
-13-22-6 DIFF cash25 : strokepath - Same as 13-20-6 cahs25. Assign: Igor.
+13-22-6 OK rev 7617.
13-23-1 DIFF Extra line under /ordfeminine and /ordmasculine characters. - ADC
Analyzed by Igor. This is a font issue.
@@ -3069,7 +3049,7 @@
13-24-5 OK Minor differences visually reviewed by Igor.
-13-24-6 DIFF A different glyph placement - strokepath - same as 13-20-6 Assign: Igor.
+13-24-6 DIFF A different glyph placement - strokepath - Assign: Igor.
13-25-1 OK
@@ -3094,7 +3074,7 @@
13-26-8 AOK Minor differences in colors - ADC
-13-26-9 DIFF Same as 13-20-6 strokepath. Assign: Igor.
+13-26-9 OK rev 7617.
13-27-1 OK Minor differences visually reviewed by RJJ
@@ -3110,7 +3090,7 @@
13-27-7 AOK Minor differences in colors - ADC
-13-27-8 DIFF Underlines differ - strokepath - same as 13-20-6 cash25 Assign: Igor.
+13-27-8 OK rev 7617.
13-28-1 OK Minor differences visually reviewed by RJJ
@@ -3128,7 +3108,7 @@
13-28-8 AOK Minor differences in colors - ADC
-13-28-9 DIFF Underlines differ - strokepath - same as 13-20-6 cash25 Assign: Igor.
+13-28-9 OK rev 7617.
13-29-1 OK Minor differences visually reviewed by RJJ
@@ -3144,7 +3124,7 @@
13-29-7 OK Minor differences visually reviewed by Igor.
-13-29-8 DIFF A different glyph placement - strokepath - same as 13-20-6 Assign: Igor.
+13-29-8 OK rev 7617.
14-01-1 OK Minor differences visually reviewed by RJJ
@@ -4781,7 +4761,8 @@
29-05-1 DIFF Rev 7595 MSVC8 debug build fails with no output pages.
Error: /invalidaccess in --forall--, likely in a halftone.
- Assign: Alex.
+ Alex can't reproduce.
+ Assign: Igor.
29-05-2 OK
Modified: trunk/gs/src/gxstroke.c
===================================================================
--- trunk/gs/src/gxstroke.c 2007-01-17 21:10:47 UTC (rev 7616)
+++ trunk/gs/src/gxstroke.c 2007-01-18 20:25:30 UTC (rev 7617)
@@ -260,7 +260,11 @@
typedef stroke_line_proc((*stroke_line_proc_t));
private stroke_line_proc(stroke_add);
+private stroke_line_proc(stroke_add_compat);
private stroke_line_proc(stroke_fill);
+private int stroke_add_initial_cap_compat(gx_path * ppath, pl_ptr plp, bool adlust_longitude,
+ const gx_device_color * pdevc, gx_device * dev,
+ const gs_imager_state * pis);
/* Define the orientations we handle specially. */
typedef enum {
@@ -282,8 +286,9 @@
const gs_imager_state * pis, const gx_stroke_params * params,
const gx_device_color * pdevc, const gx_clip_path * pcpath)
{
+ extern bool CPSI_mode;
stroke_line_proc_t line_proc =
- (to_path == 0 ? stroke_fill : stroke_add);
+ (to_path == 0 ? stroke_fill : CPSI_mode ? stroke_add_compat : stroke_add);
gs_fixed_rect ibox, cbox;
gx_device_clip cdev;
gx_device *dev = pdev;
@@ -765,6 +770,13 @@
if (code < 0)
goto exit;
FILL_STROKE_PATH(always_thin);
+ if (CPSI_mode && lptr == 0 && pgs_lp->cap != gs_cap_butt) {
+ /* Create the initial cap at last. */
+ code = stroke_add_initial_cap_compat(to_path, &pl_first, index == 1, pdevc, dev, pis);
+ if (code < 0)
+ goto exit;
+ FILL_STROKE_PATH(always_thin);
+ }
}
psub = (const subpath *)pseg;
}
@@ -1155,8 +1167,7 @@
if (first == 0 && pgs_lp->cap == gs_cap_round) {
vd_moveto(plp->o.co.x, plp->o.co.y);
if ((code = gx_path_add_point(ppath, plp->o.co.x, plp->o.co.y)) < 0 ||
- (code = add_round_cap(ppath, &plp->o)) < 0
- )
+ (code = add_round_cap(ppath, &plp->o)) < 0)
return code;
npoints = 0;
moveto_first = false;
@@ -1200,6 +1211,149 @@
return gx_path_close_subpath(ppath);
}
+/* Add a CPSI-compatible segment to the path. This handles all the complex cases. */
+private int
+stroke_add_compat(gx_path * ppath, int first, pl_ptr plp, pl_ptr nplp,
+ const gx_device_color * pdevc, gx_device * dev,
+ const gs_imager_state * pis, const gx_stroke_params * params,
+ const gs_fixed_rect * ignore_pbbox, int uniform, gs_line_join join,
+ bool reflected)
+{
+ /* Actually it adds 2 contours : one for the segment itself,
+ and another one for line join or for the ending cap.
+ Note CPSI creates negative contours. */
+ const gx_line_params *pgs_lp = gs_currentlineparams_inline(pis);
+ gs_fixed_point points[5];
+ int npoints;
+ bool const moveto_first = true; /* Keeping this code closer to "stroke_add". */
+ int code;
+
+ if (plp->thin) {
+ /* We didn't set up the endpoint parameters before, */
+ /* because the line was thin. Do it now. */
+ set_thin_widths(plp);
+ adjust_stroke(plp, pis, true, first == 0 && nplp == 0);
+ compute_caps(plp);
+ }
+ /* The segment itself : */
+ ASSIGN_POINT(&points[0], plp->o.ce);
+ ASSIGN_POINT(&points[1], plp->e.co);
+ ASSIGN_POINT(&points[2], plp->e.ce);
+ ASSIGN_POINT(&points[3], plp->o.co);
+ code = add_points(ppath, points, 4, moveto_first);
+ if (code < 0)
+ return code;
+ code = gx_path_close_subpath(ppath);
+ if (code < 0)
+ return code;
+ vd_closepath;
+ npoints = 0;
+ if (nplp == 0) {
+ /* Add a final cap. */
+ if (pgs_lp->cap == gs_cap_butt)
+ return 0;
+ if (pgs_lp->cap == gs_cap_round) {
+ ASSIGN_POINT(&points[npoints], plp->e.co);
+ vd_lineto(points[npoints].x, points[npoints].y);
+ ++npoints;
+ if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
+ return code;
+ return add_round_cap(ppath, &plp->e);
+ }
+ ASSIGN_POINT(&points[0], plp->e.ce);
+ ++npoints;
+ ASSIGN_POINT(&points[npoints], plp->e.co);
+ ++npoints;
+ code = cap_points(pgs_lp->cap, &plp->e, points + npoints);
+ if (code < 0)
+ return code;
+ npoints += code;
+ } else if (join == gs_join_round) {
+ ASSIGN_POINT(&points[npoints], plp->e.co);
+ vd_lineto(points[npoints].x, points[npoints].y);
+ ++npoints;
+ if ((code = add_points(ppath, points, npoints, moveto_first)) < 0)
+ return code;
+ return add_round_cap(ppath, &plp->e);
+ } else if (nplp->thin) { /* no join */
+ npoints = 0;
+ } else { /* non-round join */
+ bool ccw =
+ (double)(plp->width.x) /* x1 */ * (nplp->width.y) /* y2 */ >
+ (double)(nplp->width.x) /* x2 */ * (plp->width.y) /* y1 */;
+
+ if (ccw ^ reflected) {
+ ASSIGN_POINT(&points[0], plp->e.co);
+ vd_lineto(points[0].x, points[0].y);
+ ++npoints;
+ code = line_join_points(pgs_lp, plp, nplp, points + npoints,
+ (uniform ? (gs_matrix *) 0 : &ctm_only(pis)),
+ join, reflected);
+ if (code < 0)
+ return code;
+ code--; /* Drop the last point of the non-compatible mode. */
+ npoints += code;
+ } else {
+ code = line_join_points(pgs_lp, plp, nplp, points,
+ (uniform ? (gs_matrix *) 0 : &ctm_only(pis)),
+ join, reflected);
+ if (code < 0)
+ return code;
+ ASSIGN_POINT(&points[0], plp->e.ce); /* Replace the starting point of the non-compatible mode. */
+ npoints = code;
+ }
+ }
+ code = add_points(ppath, points, npoints, moveto_first);
+ if (code < 0)
+ return code;
+ code = gx_path_close_subpath(ppath);
+ vd_closepath;
+ return code;
+}
+
+/* Add a CPSI-compatible segment to the path. This handles all the complex cases. */
+private int
+stroke_add_initial_cap_compat(gx_path * ppath, pl_ptr plp, bool adlust_longitude,
+ const gx_device_color * pdevc, gx_device * dev,
+ const gs_imager_state * pis)
+{
+ const gx_line_params *pgs_lp = gs_currentlineparams_inline(pis);
+ gs_fixed_point points[4];
+ int npoints = 0;
+ int code;
+
+ if (pgs_lp->cap == gs_cap_butt)
+ return 0;
+ if (plp->thin) {
+ /* We didn't set up the endpoint parameters before, */
+ /* because the line was thin. Do it now. */
+ set_thin_widths(plp);
+ adjust_stroke(plp, pis, true, adlust_longitude);
+ compute_caps(plp);
+ }
+ /* Create an initial cap if desired. */
+ if (pgs_lp->cap == gs_cap_round) {
+ vd_moveto(plp->o.co.x, plp->o.co.y);
+ if ((code = gx_path_add_point(ppath, plp->o.co.x, plp->o.co.y)) < 0 ||
+ (code = add_round_cap(ppath, &plp->o)) < 0
+ )
+ return code;
+ return 0;
+ } else {
+ ASSIGN_POINT(&points[0], plp->o.co);
+ ++npoints;
+ if ((code = cap_points(pgs_lp->cap, &plp->o, points + npoints)) < 0)
+ return npoints;
+ npoints += code;
+ ASSIGN_POINT(&points[npoints], plp->o.ce);
+ ++npoints;
+ code = add_points(ppath, points, npoints, true);
+ if (code < 0)
+ return code;
+ return gx_path_close_subpath(ppath);
+ }
+}
+
/* Add lines with a possible initial moveto. */
private int
add_points(gx_path * ppath, const gs_fixed_point * points, int npoints,
More information about the gs-cvs
mailing list