[dia] Bug 637611 - Mangled SVG import (incomplete line-to handling)
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Bug 637611 - Mangled SVG import (incomplete line-to handling)
- Date: Fri, 7 Jan 2011 00:00:44 +0000 (UTC)
commit a0b7dc63c20d224d7553d2dd62668d388636a271
Author: Hans Breuer <hans breuer org>
Date: Fri Jan 7 00:59:56 2011 +0100
Bug 637611 - Mangled SVG import (incomplete line-to handling)
There is a serious limitation with Dia's standard bezier serialization.
It can only represent a single move-to at the beginning and following
bezier points are assumed to be curve-to.
There is a more complete implementation by data_add_bezpoint and
data_bezpoint, but using that would hamper forward compatibility.
So implemented a work-around in dia_svg_parse_path() which reproduces
line-to appearance also by curve-to control points.
lib/dia_svg.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/lib/dia_svg.c b/lib/dia_svg.c
index 0d1461d..a214113 100644
--- a/lib/dia_svg.c
+++ b/lib/dia_svg.c
@@ -741,6 +741,14 @@ dia_svg_parse_path(const gchar *path_str, gchar **unparsed, gboolean *closed)
bez.p1.x += last_point.x;
bez.p1.y += last_point.y;
}
+ /* Strictly speeaking it should not be necessary to assign the other
+ * two points. But it helps hiding a serious limitation with the
+ * standard bezier serialization, namely only saving one move-to
+ * and the rest as curve-to */
+#define INIT_LINE_TO_AS_CURVE_TO bez.p3 = bez.p1; bez.p2 = last_point
+
+ INIT_LINE_TO_AS_CURVE_TO;
+
last_point = bez.p1;
last_control = bez.p1;
@@ -753,6 +761,9 @@ dia_svg_parse_path(const gchar *path_str, gchar **unparsed, gboolean *closed)
bez.p1.y = last_point.y;
if (last_relative)
bez.p1.x += last_point.x;
+
+ INIT_LINE_TO_AS_CURVE_TO;
+
last_point = bez.p1;
last_control = bez.p1;
@@ -765,6 +776,11 @@ dia_svg_parse_path(const gchar *path_str, gchar **unparsed, gboolean *closed)
path_chomp(path);
if (last_relative)
bez.p1.y += last_point.y;
+
+ INIT_LINE_TO_AS_CURVE_TO;
+
+#undef INIT_LINE_TO_AS_CURVE_TO
+
last_point = bez.p1;
last_control = bez.p1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]