[dia] svg: path codes 'q' and 't' debugged
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] svg: path codes 'q' and 't' debugged
- Date: Fri, 16 Aug 2013 17:08:45 +0000 (UTC)
commit 23c9f93908102b36b3208576121d4d7206a716dc
Author: Hans Breuer <hans breuer org>
Date: Sat Aug 10 18:58:49 2013 +0200
svg: path codes 'q' and 't' debugged
Now the reference W3C_SVG_11_TestSuite/svg/paths-data-02-t.svg
is shown correctly (after some trial and error;))
lib/dia_svg.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/lib/dia_svg.c b/lib/dia_svg.c
index 6747001..710f2bc 100644
--- a/lib/dia_svg.c
+++ b/lib/dia_svg.c
@@ -1212,20 +1212,26 @@ dia_svg_parse_path(GArray *points, const gchar *path_str, gchar **unparsed,
path_chomp(path);
y1 = g_ascii_strtod(path, &path);
path_chomp(path);
+ if (last_relative) {
+ x1 += last_point.x;
+ y1 += last_point.y;
+ }
bez.type = BEZ_CURVE_TO;
bez.p1.x = (last_point.x + 2 * x1) * (1.0 / 3.0);
- bez.p1.y = (last_point.x + 2 * y1) * (1.0 / 3.0);
+ bez.p1.y = (last_point.y + 2 * y1) * (1.0 / 3.0);
bez.p3.x = g_ascii_strtod(path, &path);
path_chomp(path);
bez.p3.y = g_ascii_strtod(path, &path);
path_chomp(path);
- bez.p2.x = (bez.p3.x + 2 * x1) * (1.0 / 3.0);
- bez.p2.y = (bez.p3.y + 2 * y1) * (1.0 / 3.0);
if (last_relative) {
- /* ToDo: ??? */
+ bez.p3.x += last_point.x;
+ bez.p3.y += last_point.y;
}
+ bez.p2.x = (bez.p3.x + 2 * x1) * (1.0 / 3.0);
+ bez.p2.y = (bez.p3.y + 2 * y1) * (1.0 / 3.0);
last_point = bez.p3;
- last_control = bez.p2;
+ last_control.x = x1;
+ last_control.y = y1;
g_array_append_val(points, bez);
}
break;
@@ -1244,13 +1250,15 @@ dia_svg_parse_path(GArray *points, const gchar *path_str, gchar **unparsed,
path_chomp(path);
bez.p3.y = g_ascii_strtod(path, &path);
path_chomp(path);
- bez.p2.x = (bez.p3.x + 2 * xc) * (1.0 / 3.0);
- bez.p2.y = (bez.p3.y + 2 * yc) * (1.0 / 3.0);
if (last_relative) {
- /* ToDo: ??? */
+ bez.p3.x += last_point.x;
+ bez.p3.y += last_point.y;
}
+ bez.p2.x = (bez.p3.x + 2 * xc) * (1.0 / 3.0);
+ bez.p2.y = (bez.p3.y + 2 * yc) * (1.0 / 3.0);
last_point = bez.p3;
- last_control = bez.p2;
+ last_control.x = xc;
+ last_control.y = yc;
g_array_append_val(points, bez);
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]