[gnumeric] xlsx: properly parse scrgbClr.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xlsx: properly parse scrgbClr.
- Date: Mon, 30 Mar 2015 22:22:40 +0000 (UTC)
commit 21e6a65f41042edf26feff104ad9e0a48318a51e
Author: Morten Welinder <terra gnome org>
Date: Mon Mar 30 18:22:26 2015 -0400
xlsx: properly parse scrgbClr.
That probably stands for seperate-channel rgb.
plugins/excel/ChangeLog | 1 +
plugins/excel/xlsx-read-drawing.c | 24 +++++++++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index a1aa913..e2b7178 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -3,6 +3,7 @@
* xlsx-read-drawing.c (xlsx_draw_color_rgba_channel): Rename from
xlsx_draw_color_alpha. Handle all four channels.
(xlsx_draw_color_hsl_channel): Hook up hue-sat-lum modification.
+ (xlsx_draw_color_scrgb): Properly parse <scrgbClr>.
2015-03-30 Jean Brefort <jean brefort normalesup org>
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index dc2a1d3..d1ccd69 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -534,6 +534,28 @@ xlsx_draw_color_rgb (GsfXMLIn *xin, xmlChar const **attrs)
}
static void
+xlsx_draw_color_scrgb (GsfXMLIn *xin, xmlChar const **attrs)
+{
+ XLSXReadState *state = (XLSXReadState *)xin->user_state;
+ int r = 0, g = 0, b = 0;
+ int scale = 100000;
+
+ for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) {
+ if (attr_int (xin, attrs, "r", &r) ||
+ attr_int (xin, attrs, "g", &g) ||
+ attr_int (xin, attrs, "b", &b)) {
+ /* Nothing more */
+ }
+ }
+
+ r = 255 * CLAMP (r, 0, scale) / scale;
+ g = 255 * CLAMP (g, 0, scale) / scale;
+ b = 255 * CLAMP (b, 0, scale) / scale;
+ state->color = GO_COLOR_FROM_RGB (r, g, b);
+ color_set_helper (state);
+}
+
+static void
xlsx_draw_color_rgba_channel (GsfXMLIn *xin, xmlChar const **attrs)
{
XLSXReadState *state = (XLSXReadState *)xin->user_state;
@@ -3388,7 +3410,7 @@ GSF_XML_IN_NODE_FULL (START, DRAWING, XL_NS_SS_DRAW, "wsDr", GSF_XML_NO_CONTENT,
GSF_XML_IN_NODE (SP_XFRM_STYLE, LN_REF, XL_NS_DRAW, "lnRef", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (LN_REF, SCHEME_CLR, XL_NS_DRAW, "schemeClr", GSF_XML_NO_CONTENT, NULL, NULL),
COLOR_MODIFIER_NODES(SCHEME_CLR,1),
- GSF_XML_IN_NODE (LN_REF, SCRGB_CLR, XL_NS_DRAW, "scrgbClr", GSF_XML_NO_CONTENT,
xlsx_draw_color_rgb, NULL),
+ GSF_XML_IN_NODE (LN_REF, SCRGB_CLR, XL_NS_DRAW, "scrgbClr", GSF_XML_NO_CONTENT,
xlsx_draw_color_scrgb, NULL),
COLOR_MODIFIER_NODES(SCRGB_CLR,0),
GSF_XML_IN_NODE (SP_XFRM_STYLE, FILL_REF, XL_NS_DRAW, "fillRef", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (FILL_REF, SCHEME_CLR, XL_NS_DRAW, "schemeClr", GSF_XML_NO_CONTENT, NULL, NULL),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]