[goffice] Fix pixbuf saving when cairo data has not been generated. [see #672716]



commit 6ec69513f3a478d877309c744094ff44c00e9ffc
Author: Jean Brefort <jean brefort normalesup org>
Date:   Mon Mar 26 10:21:24 2012 +0200

    Fix pixbuf saving when cairo data has not been generated. [see #672716]

 ChangeLog                 |    5 +++++
 goffice/utils/go-pixbuf.c |   11 +++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index deab84c..d266860 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-26  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/utils/go-pixbuf.c (go_pixbuf_save): fix pixbuf saving when cairo
+	data has not been generated. [see #672716]
+
 2012-03-25  Morten Welinder  <terra gnome org>
 
 	* tools/embedder (embed_data): When we go to a new line, clear the
diff --git a/goffice/utils/go-pixbuf.c b/goffice/utils/go-pixbuf.c
index 7ba1d36..87ec88b 100644
--- a/goffice/utils/go-pixbuf.c
+++ b/goffice/utils/go-pixbuf.c
@@ -293,10 +293,13 @@ go_pixbuf_save (GOImage *image, GsfXMLOut *output)
 	g_return_if_fail (GO_IS_PIXBUF (image));
 	pixbuf = GO_PIXBUF (image);
 	gsf_xml_out_add_int (output, "rowstride", pixbuf->rowstride);
-	if (image->data)
-		gsf_xml_out_add_base64
-			(output, NULL,
-			 image->data, image->height * pixbuf->rowstride);
+	if (!image->data) {
+		image->data = g_new0 (guint8, image->height * pixbuf->rowstride);
+		pixbuf_to_cairo (pixbuf);
+	}
+	gsf_xml_out_add_base64
+		(output, NULL,
+		 image->data, image->height * pixbuf->rowstride);
 }
 
 static void



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