From 7b94a21fcab05f63b6ab3cc1831fcd61b0d3df16 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Wed, 25 Apr 2012 21:57:55 +0200 Subject: [PATCH] corection of the filling and stroking at none error --- Sources/libparsersvg/parserSVG/Base.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Sources/libparsersvg/parserSVG/Base.cpp b/Sources/libparsersvg/parserSVG/Base.cpp index 743f008d..6a1b6e9c 100644 --- a/Sources/libparsersvg/parserSVG/Base.cpp +++ b/Sources/libparsersvg/parserSVG/Base.cpp @@ -216,13 +216,21 @@ const char * extractPartOfStyle(const char * input, char * outputType, char * ou */ void svg::Base::ParsePaintAttr(const TiXmlNode *node) { + bool fillNone = false; + bool strokeNone = false; const char * content = node->ToElement()->Attribute("fill"); if (NULL != content) { m_paint.fill = ParseColor(content); + if (m_paint.fill.alpha == 0) { + fillNone = true; + } } content = node->ToElement()->Attribute("stroke"); if (NULL != content) { m_paint.stroke = ParseColor(content); + if (m_paint.stroke.alpha == 0) { + strokeNone = true; + } } content = node->ToElement()->Attribute("stroke-width"); if (NULL != content) { @@ -295,9 +303,15 @@ void svg::Base::ParsePaintAttr(const TiXmlNode *node) if (0 == strcmp(outputType, "fill") ) { m_paint.fill = ParseColor(outputValue); SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.fill); + if (m_paint.fill.alpha == 0) { + fillNone = true; + } } else if (0 == strcmp(outputType, "stroke") ) { m_paint.stroke = ParseColor(outputValue); SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.stroke); + if (m_paint.stroke.alpha == 0) { + strokeNone = true; + } } else if (0 == strcmp(outputType, "stroke-width") ) { m_paint.strokeWidth = ParseLength(outputValue); SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.strokeWidth); @@ -354,6 +368,13 @@ void svg::Base::ParsePaintAttr(const TiXmlNode *node) } } } + // check if somewere none is set to the filling: + if (true == fillNone) { + m_paint.fill.alpha = 0; + } + if (true == strokeNone) { + m_paint.stroke.alpha = 0; + } } bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen)