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

leonardo at ghostscript.com leonardo at ghostscript.com
Wed Jan 23 10:12:28 PST 2008


Author: leonardo
Date: 2008-01-23 10:12:27 -0800 (Wed, 23 Jan 2008)
New Revision: 8501

Modified:
   trunk/gs/src/gdevpdfi.c
   trunk/gs/src/zpcolor.c
Log:
Fix (patterns) : The clipping was wrong with antrivial pattern matrix (continued).

DETAILS :

Bug 687196 "Incorrect pattern processing from Adobe test file pattyp1.ps".
This is a partial fix for the bug, which fixes vector devices only.
It closes the bug with the last patch applied.

The old code set identity matrix for a pattern dstream accummulation.
It appears incompatible with Type 2 pattern handler, which assumes
the default page matrix. This patch changes the matrix and improves
the pattern stream accumulator with accounting the default page scale. 

EXPECTED DIFFERENCES :

Minor differences caused by better coordinate precision in patterns with pdfwrite :

"027-13.ps" 
"123-09.ps" 
"176-01.ps" 
"298-09.ps" 
"321-09.ps" 
"Bug688308.ps" 


Modified: trunk/gs/src/gdevpdfi.c
===================================================================
--- trunk/gs/src/gdevpdfi.c	2008-01-23 18:09:49 UTC (rev 8500)
+++ trunk/gs/src/gdevpdfi.c	2008-01-23 18:12:27 UTC (rev 8501)
@@ -1379,6 +1379,9 @@
 	    code = pdf_store_pattern1_params(pdev, pres, pinst);
 	    if (code < 0)
 		return code;
+	    /* Scale the coordinate system, because object handlers assume so. See none_to_stream. */
+	    pprintg2(pdev->strm, "q %g 0 0 %g 0 0 cm\n",
+		     72.0 / pdev->HWResolution[0], 72.0 / pdev->HWResolution[1]);
 	    return 1;
 	case pattern_manage__finish_accum:
 	    code = pdf_add_procsets(pdev->substream_Resources, pdev->procsets);

Modified: trunk/gs/src/zpcolor.c
===================================================================
--- trunk/gs/src/zpcolor.c	2008-01-23 18:09:49 UTC (rev 8500)
+++ trunk/gs/src/zpcolor.c	2008-01-23 18:12:27 UTC (rev 8501)
@@ -279,14 +279,20 @@
 	gs_setdevice_no_init(pgs, (gx_device *)pdev);
     else {
 	gs_matrix m;
+	gs_rect bbox;
 	gs_fixed_rect clip_box;
 
-	gs_make_identity(&m);
+	dev_proc(pgs->device, get_initial_matrix)(pgs->device, &m);
 	gs_setmatrix(igs, &m);
-	clip_box.p.x = float2fixed(pinst->template.BBox.p.x);
-	clip_box.p.y = float2fixed(pinst->template.BBox.p.y);
-	clip_box.q.x = float2fixed(pinst->template.BBox.q.x);
-	clip_box.q.y = float2fixed(pinst->template.BBox.q.y);
+	code = gs_bbox_transform(&pinst->template.BBox, &ctm_only(pgs), &bbox);
+	if (code < 0) {
+	    gs_grestore(pgs);
+	    return code;
+	}
+	clip_box.p.x = float2fixed(bbox.p.x);
+	clip_box.p.y = float2fixed(bbox.p.y);
+	clip_box.q.x = float2fixed(bbox.q.x);
+	clip_box.q.y = float2fixed(bbox.q.y);
 	code = gx_clip_to_rectangle(igs, &clip_box);
 	if (code < 0) {
 	    gs_grestore(pgs);



More information about the gs-cvs mailing list