[goffice] Load EMF image size from the data.



commit 9a092121fc5cf5fd26998245c179819e481b9f52
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Mar 9 08:13:41 2013 +0100

    Load EMF image size from the data.

 ChangeLog              |    5 +++++
 goffice/utils/go-emf.c |    6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f08d75e..73c9372 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-03-09  Jean Brefort  <jean brefort normalesup org>
+
+       * goffice/utils/go-emf.c (go_emf_new_from_file),
+       (go_emf_new_from_data), (go_emf_parse): Load imege size fro the data.
+
 2013-03-08  Jean Brefort  <jean brefort normalesup org>
 
        * goffice/canvas/goc-arc.c (goc_arc_draw): removed an extra cairo_save().
diff --git a/goffice/utils/go-emf.c b/goffice/utils/go-emf.c
index 559ee81..5c6b3ea 100644
--- a/goffice/utils/go-emf.c
+++ b/goffice/utils/go-emf.c
@@ -242,7 +242,7 @@ go_emf_new_from_file (char const *filename, GError **error)
                        /* try to get a pixbuf */
                        load_wmf_as_pixbuf (image, data, size);
                }
-       } else {
+       } else if (image->width == 0 || image->height == 0) {
                double x0, y0, x1, y1;
                goc_canvas_get_bounds (emf->canvas, &x0, &y0, &x1, &y1);
                image->width = x1;
@@ -277,7 +277,7 @@ go_emf_new_from_data (char const *data, size_t length, GError **error)
                        /* try to get a pixbuf */
                        load_wmf_as_pixbuf (image, data, length);
                }
-       } else {
+       } else if (image->width == 0 || image->height == 0) {
                double x0, y0, x1, y1;
                goc_canvas_get_bounds (emf->canvas, &x0, &y0, &x1, &y1);
                image->width = x1;
@@ -4695,6 +4695,8 @@ go_emf_parse (GOEmf *emf, GsfInput *input, GError **error)
                        return FALSE;
                } else {
                        go_emf_handlers[rid] (&state); /* just for debugging */
+                       emf->parent.width = (state.mmbounds.right - state.mmbounds.left) / 2540. * 72.;
+                       emf->parent.height = (state.mmbounds.bottom - state.mmbounds.top) / 2540. * 72.;
                        return TRUE;
                }
        }


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