[gs-cvs] rev 9375 - trunk/ghostpdl/xps
tor at ghostscript.com
tor at ghostscript.com
Mon Jan 19 09:13:58 PST 2009
Author: tor
Date: 2009-01-19 09:13:58 -0800 (Mon, 19 Jan 2009)
New Revision: 9375
Modified:
trunk/ghostpdl/xps/xpstile.c
Log:
Add some sanity checks to avoid zero sized images that resulted in infinite scale factors.
Modified: trunk/ghostpdl/xps/xpstile.c
===================================================================
--- trunk/ghostpdl/xps/xpstile.c 2009-01-19 11:13:05 UTC (rev 9374)
+++ trunk/ghostpdl/xps/xpstile.c 2009-01-19 17:13:58 UTC (rev 9375)
@@ -169,6 +169,12 @@
if (viewport_att)
xps_parse_rectangle(ctx, viewport_att, &viewport);
+ /* some sanity checks on the viewport/viewbox size */
+ if (fabs(viewport.q.x - viewport.p.x) < 0.01) return 0;
+ if (fabs(viewport.q.y - viewport.p.y) < 0.01) return 0;
+ if (fabs(viewbox.q.x - viewbox.p.x) < 0.01) return 0;
+ if (fabs(viewbox.q.y - viewbox.p.y) < 0.01) return 0;
+
scalex = (viewport.q.x - viewport.p.x) / (viewbox.q.x - viewbox.p.x);
scaley = (viewport.q.y - viewport.p.y) / (viewbox.q.y - viewbox.p.y);
More information about the gs-cvs
mailing list