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

raph at ghostscript.com raph at ghostscript.com
Wed Aug 9 10:48:58 PDT 2006


Author: raph
Date: 2006-08-09 10:48:58 -0700 (Wed, 09 Aug 2006)
New Revision: 6981

Modified:
   trunk/gs/src/gdevpdfv.c
Log:
Fix: Change pdfwrite pattern bbox to use PDF compliant syntax for float
bbox coordinates, rather than sprintf %g. Fixes (reopened) bug #688167.



Modified: trunk/gs/src/gdevpdfv.c
===================================================================
--- trunk/gs/src/gdevpdfv.c	2006-08-09 01:29:21 UTC (rev 6980)
+++ trunk/gs/src/gdevpdfv.c	2006-08-09 17:48:58 UTC (rev 6981)
@@ -200,14 +200,16 @@
     double scale_y = pdev->HWResolution[1] / 72.0;
     cos_dict_t *pcd = cos_stream_dict((cos_stream_t *)pres->object);
     cos_dict_t *pcd_Resources = cos_dict_alloc(pdev, "pdf_pattern(Resources)");
-    char buf[60];
+    float bbox[4];
     int code;
 
     if (pcd == NULL || pcd_Resources == NULL)
 	return_error(gs_error_VMerror);
     pdev->substream_Resources = pcd_Resources;
-    sprintf(buf, "[%g %g %g %g]", t->BBox.p.x, t->BBox.p.y, 
-				  t->BBox.q.x, t->BBox.q.y);
+    bbox[0] = t->BBox.p.x;
+    bbox[1] = t->BBox.p.y;
+    bbox[2] = t->BBox.q.x;
+    bbox[3] = t->BBox.q.y;
     /* The graphics library assumes a shifted origin to provide 
        positive bitmap pixel indices. Compensate it now. */
     smat.tx += pinst->step_matrix.tx;
@@ -230,7 +232,7 @@
     if (code >= 0)
 	code = cos_dict_put_c_key_int(pcd, "/TilingType", t->TilingType);
     if (code >= 0)
-	code = cos_dict_put_string(pcd, (byte *)"/BBox", 5, (byte *)buf, strlen(buf));
+	code = cos_dict_put_c_key_floats(pcd, "/BBox", bbox, 4);
     if (code >= 0)
 	code = cos_dict_put_matrix(pcd, "/Matrix", &smat);
     if (code >= 0)



More information about the gs-cvs mailing list