[gnumeric] Make emebedded image saving work again.



commit c22188e3a34429d5e7d55760c867422e3b199de5
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Mar 10 15:49:46 2012 +0100

    Make emebedded image saving work again.

 ChangeLog                |    4 ++++
 src/sheet-object-image.c |   13 +++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2c64b04..def281c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-10  Jean Brefort  <jean brefort normalesup org>
+
+	* src/sheet-object-image.c (gnm_soi_write_image): make it work again.
+
 2012-03-09  Morten Welinder  <terra gnome org>
 
 	* src/sheet-style.c (sheet_style_is_default)
diff --git a/src/sheet-object-image.c b/src/sheet-object-image.c
index 3ec0835..94ac0dd 100644
--- a/src/sheet-object-image.c
+++ b/src/sheet-object-image.c
@@ -282,10 +282,15 @@ gnm_soi_write_image (SheetObject const *so, char const *format, double resolutio
 	gboolean res = FALSE;
 	GdkPixbuf *pixbuf = go_image_get_pixbuf (soi->image);
 
-	if (!soi->type || strcmp (format, soi->type) == 0)
-		res = gsf_output_write (output,
-					soi->bytes.len, soi->bytes.data);
-	else if (pixbuf)
+	if (!soi->type || strcmp (format, soi->type) == 0) {
+		if (soi->bytes.len == 0) {
+			gsize length;
+			guint8 const *data = go_image_get_data (soi->image, &length);
+			res = gsf_output_write (output,	length, data);
+		} else
+			res = gsf_output_write (output,
+						soi->bytes.len, soi->bytes.data);
+	} else if (pixbuf)
 		res = gdk_pixbuf_save_to_callback (pixbuf,
 						   soi_gdk_pixbuf_save, output,
 						   format,



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