From e5feb4b17ce16b17ee7ff19188072c25c736bf90 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Sun, 19 Jan 2014 07:43:14 -0500 Subject: fix scaling crash caused by negative stroke (Bug 1270464) Fixed bugs: - https://launchpad.net/bugs/1270464 (bzr r12956) --- src/sp-item-transform.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/sp-item-transform.cpp') diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index 9dbe412d7..854fb9cd7 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -110,6 +110,9 @@ Geom::Affine get_scale_transform_for_uniform_stroke(Geom::Rect const &bbox_visua // -> The width and height of the geometric bounding box will therefore be (w0 - 2*0.5*r0) and (h0 - 2*0.5*r0) // 4) If preserve transforms is true, then stroke_x != stroke_y, since these are the apparent stroke widths, after transforming + if ((stroke_x == Geom::infinity()) || (fabs(stroke_x) < 1e-6)) stroke_x = 0; + if ((stroke_y == Geom::infinity()) || (fabs(stroke_y) < 1e-6)) stroke_y = 0; + gdouble w0 = bbox_visual.width(); // will return a value >= 0, as required further down the road gdouble h0 = bbox_visual.height(); gdouble r0 = sqrt(stroke_x*stroke_y); // r0 is redundant, used only for those cases where stroke_x = stroke_y -- cgit v1.2.3