[dia] [transform] Improved dia_svg_parse_transform()



commit e70ea9b106c65abebcbf3b99da9d0629126fddb8
Author: Hans Breuer <hans breuer org>
Date:   Fri Sep 24 19:04:16 2010 +0200

    [transform] Improved dia_svg_parse_transform()
    
    The parsing of transform=rotate() did not yield the expected result.

 lib/dia_svg.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/lib/dia_svg.c b/lib/dia_svg.c
index fd50e57..0e69ef3 100644
--- a/lib/dia_svg.c
+++ b/lib/dia_svg.c
@@ -929,13 +929,21 @@ dia_svg_parse_transform(const gchar *trans, real scale)
     real angle;
     
     if (list[i])
-      angle = g_ascii_strtod (list[i], NULL);
+      angle = g_ascii_strtod (list[i], NULL), ++i;
+    else
+      g_warning ("transform=rotate no angle?");
     m->xx =  cos(G_PI*angle/180);
-    m->xy =  sin(G_PI*angle/180);
-    m->yx = -sin(G_PI*angle/180);
+    /* FIXME: swapped xy and yx - correct? */
+    m->xy = -sin(G_PI*angle/180);
+    m->yx =  sin(G_PI*angle/180);
     m->yy =  cos(G_PI*angle/180);
+    /* FIXME: check with real world data, I'm uncertain */
+    if (list[i])
+      m->x0 = g_ascii_strtod (list[i], NULL), ++i;
+    if (list[i])
+      m->y0 = g_ascii_strtod (list[i], NULL), ++i;
   } else {
-    g_warning ("%s?", trans);
+    g_warning ("SVG: %s?", trans);
     g_free (m);
     m = NULL;
   }



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