[gnumeric] .gnumeric: fix colour export.



commit e0b6a12f215857b578bb127e96450994b62a6400
Author: Morten Welinder <terra gnome org>
Date:   Sat Mar 10 16:27:12 2012 -0500

    .gnumeric: fix colour export.

 ChangeLog            |    2 ++
 NEWS                 |    1 +
 src/xml-sax-write.c  |    6 +++---
 test/t5902-applix.pl |    2 +-
 4 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 19b3dc1..24f1de6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 
 	* src/xml-sax-write.c (xml_write_colrow_info): Don't write records
 	that match the default col/row style.
+	(gnm_xml_out_add_gocolor): Don't go through GdkRGBA which causes
+	rounding problems.
 
 	* src/sheet-object-widget.h: Grand rename.  Make GNM_IS_SOW
 	public.
diff --git a/NEWS b/NEWS
index ef65510..370059f 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,7 @@ Morten:
 	* Export non-visible style stuff to xls.  [Part of #671513]
 	* Improve xls import re. hard column widths.
 	* Export only needed col/row styles to .gnumeric.
+	* Fix export of colours to .gnumeric.
 
 --------------------------------------------------------------------------
 Gnumeric 1.11.2
diff --git a/src/xml-sax-write.c b/src/xml-sax-write.c
index d744855..c8d507f 100644
--- a/src/xml-sax-write.c
+++ b/src/xml-sax-write.c
@@ -82,9 +82,9 @@ typedef struct {
 void
 gnm_xml_out_add_gocolor (GsfXMLOut *o, char const *id, GOColor c)
 {
-	GdkRGBA tmp;
-	go_color_to_gdk_rgba (c, &tmp);
-	gsf_xml_out_add_color (o, id, tmp.red * 65535, tmp.green * 65535, tmp.blue * 65535);
+	unsigned r, g, b, a;
+	GO_COLOR_TO_RGBA (c, &r, &g, &b, &a);
+	gsf_xml_out_add_color (o, id, r * 0x101, g * 0x101, b * 0x101);
 }
 
 static void
diff --git a/test/t5902-applix.pl b/test/t5902-applix.pl
index 1780312..89c4152 100755
--- a/test/t5902-applix.pl
+++ b/test/t5902-applix.pl
@@ -9,4 +9,4 @@ use GnumericTest;
 my $mode = ((shift @ARGV) || "check");
 
 &message ("Check the applix importer.");
-&test_importer ("$samples/applix/sample.as", "f74a2741651a50cbb0f1c25fb1e5dd69aee9376b", $mode);
+&test_importer ("$samples/applix/sample.as", "1f5f5fda40fcfb572731101ed19fabbaf43b24bb", $mode);



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