[dia] cgm: fix creation of CGM Ellipse element ...



commit 2dec70ff14b56e3e07fd90ba2008b4e720eded83
Author: Hans Breuer <hans breuer org>
Date:   Sat Apr 26 14:05:29 2014 +0200

    cgm: fix creation of CGM Ellipse element ...
    
    ... which was breaking the loading of render-test.cgm and
    tests/export/Ellipse.cgm with OpenOffice and probably other
    CGM importers.
    
    According to the specs the horizontal ellipse "endpoint" must come
    first, the vertical second. Dia had it swapped since the beginning
    of time.

 plug-ins/cgm/cgm.c             |   15 +++++++++------
 tests/exports/cgm/Ellipses.cgm |  Bin 364 -> 1498 bytes
 2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/plug-ins/cgm/cgm.c b/plug-ins/cgm/cgm.c
index ca3ba4f..d089d44 100644
--- a/plug-ins/cgm/cgm.c
+++ b/plug-ins/cgm/cgm.c
@@ -685,6 +685,9 @@ set_linestyle(DiaRenderer *self, LineStyle mode)
     CgmRenderer *renderer = CGM_RENDERER(self);
     gint16   style;
 
+    /* XXX: According to specs (mil-std-2301) and tests with OpenOffice only
+     *      solid=1 and dashed=2 are supported.
+     */
     switch(mode)
     {
     case LINESTYLE_DASHED:
@@ -892,10 +895,10 @@ draw_ellipse(DiaRenderer *self,
     write_elhead(renderer->file, 4, 17, 6 * REALSIZE);
     write_real(renderer->file, center->x); /* center */
     write_real(renderer->file, ynew);
-    write_real(renderer->file, center->x);      /* axes 1 */
+    write_real(renderer->file, center->x + width/2); /* axes 1 */
+    write_real(renderer->file, ynew);
+    write_real(renderer->file, center->x); /* axes 2 */
     write_real(renderer->file, ynew + height/2);
-    write_real(renderer->file, center->x + width/2); /* axes 2 */
-    write_real(renderer->file, ynew );
 }
 
 static void
@@ -913,10 +916,10 @@ fill_ellipse(DiaRenderer *self,
     write_elhead(renderer->file, 4, 17, 6 * REALSIZE);
     write_real(renderer->file, center->x); /* center */
     write_real(renderer->file, ynew);
-    write_real(renderer->file, center->x);      /* axes 1 */
-    write_real(renderer->file, ynew + height/2);
-    write_real(renderer->file, center->x + width/2); /* axes 2 */
+    write_real(renderer->file, center->x + width/2); /* axes 1 */
     write_real(renderer->file, ynew);
+    write_real(renderer->file, center->x); /* axes 2 */
+    write_real(renderer->file, ynew + height/2);
 }
 
 
diff --git a/tests/exports/cgm/Ellipses.cgm b/tests/exports/cgm/Ellipses.cgm
index 2a5f361..8832a4e 100644
Binary files a/tests/exports/cgm/Ellipses.cgm and b/tests/exports/cgm/Ellipses.cgm differ


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