[dia] [matherr] Fix _path_arc(dia_svg.c) against bogus arcs



commit 96042c54c79ba2b6931aa03943b77b7d55024283
Author: Hans Breuer <hans breuer org>
Date:   Mon Oct 15 12:26:05 2012 +0200

    [matherr] Fix _path_arc(dia_svg.c) against bogus arcs
    
    A very small arc (1e-3x) could produce matherr when calculating
    the bezier of the arc. Now it just ignores bogus arcs.

 lib/dia_svg.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/lib/dia_svg.c b/lib/dia_svg.c
index e8d486a..a66361e 100644
--- a/lib/dia_svg.c
+++ b/lib/dia_svg.c
@@ -1071,9 +1071,13 @@ dia_svg_parse_path(GArray *points, const gchar *path_str, gchar **unparsed,
 	  dest.y += last_point.y;
 	}
 
-	_path_arc (points, last_point.x, last_point.y,
-		   rx, ry, xrot, largearc, sweep, dest.x, dest.y,
-		   &dest_c);
+	/* avoid matherr with bogus values - just ignore them
+	 * does happen e.g. with 'Chem-Widgets - clamp-large' 
+	 */
+	if (last_point.x != dest.x && last_point.y != dest.y)
+	  _path_arc (points, last_point.x, last_point.y,
+		     rx, ry, xrot, largearc, sweep, dest.x, dest.y,
+		     &dest_c);
 	last_point = dest;
 	last_control = dest_c;
       }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]