corection of the filling and stroking at none error

This commit is contained in:
Edouard Dupin 2012-04-25 21:57:55 +02:00
parent 423fa82e2f
commit 7b94a21fca

View File

@ -216,13 +216,21 @@ const char * extractPartOfStyle(const char * input, char * outputType, char * ou
*/ */
void svg::Base::ParsePaintAttr(const TiXmlNode *node) void svg::Base::ParsePaintAttr(const TiXmlNode *node)
{ {
bool fillNone = false;
bool strokeNone = false;
const char * content = node->ToElement()->Attribute("fill"); const char * content = node->ToElement()->Attribute("fill");
if (NULL != content) { if (NULL != content) {
m_paint.fill = ParseColor(content); m_paint.fill = ParseColor(content);
if (m_paint.fill.alpha == 0) {
fillNone = true;
}
} }
content = node->ToElement()->Attribute("stroke"); content = node->ToElement()->Attribute("stroke");
if (NULL != content) { if (NULL != content) {
m_paint.stroke = ParseColor(content); m_paint.stroke = ParseColor(content);
if (m_paint.stroke.alpha == 0) {
strokeNone = true;
}
} }
content = node->ToElement()->Attribute("stroke-width"); content = node->ToElement()->Attribute("stroke-width");
if (NULL != content) { if (NULL != content) {
@ -295,9 +303,15 @@ void svg::Base::ParsePaintAttr(const TiXmlNode *node)
if (0 == strcmp(outputType, "fill") ) { if (0 == strcmp(outputType, "fill") ) {
m_paint.fill = ParseColor(outputValue); m_paint.fill = ParseColor(outputValue);
SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.fill); SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.fill);
if (m_paint.fill.alpha == 0) {
fillNone = true;
}
} else if (0 == strcmp(outputType, "stroke") ) { } else if (0 == strcmp(outputType, "stroke") ) {
m_paint.stroke = ParseColor(outputValue); m_paint.stroke = ParseColor(outputValue);
SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.stroke); SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.stroke);
if (m_paint.stroke.alpha == 0) {
strokeNone = true;
}
} else if (0 == strcmp(outputType, "stroke-width") ) { } else if (0 == strcmp(outputType, "stroke-width") ) {
m_paint.strokeWidth = ParseLength(outputValue); m_paint.strokeWidth = ParseLength(outputValue);
SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.strokeWidth); 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) bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxLen)