[DEBUG] bug when parsing stroke argument and fill argument

This commit is contained in:
Edouard DUPIN 2016-01-18 22:13:17 +01:00
parent bac21ef69a
commit d3a58b2548

View File

@ -294,13 +294,11 @@ void esvg::Base::parsePaintAttr(const std::shared_ptr<const exml::Element>& _ele
m_id = _element->getAttribute("id");
// ---------------- stroke ----------------
content = _element->getAttribute("stroke");
if (content == "none") {
m_paint.stroke = std::pair<etk::Color<float,4>, std::string>(etk::color::none, "");
} else {
if (content.size()!=0) {
m_paint.stroke = parseColor(content);
/*
if (m_paint.stroke.first.a() == 0) {
strokeNone = true;
}
*/
}
content = _element->getAttribute("stroke-width");
if (content.size()!=0) {
@ -352,15 +350,14 @@ void esvg::Base::parsePaintAttr(const std::shared_ptr<const exml::Element>& _ele
float tmp = parseLength(content);
m_paint.miterLimit = std::max(0.0f, tmp);
}
}
// ---------------- FILL ----------------
content = _element->getAttribute("fill");
if (content == "none") {
m_paint.fill = std::pair<etk::Color<float,4>, std::string>(etk::color::none, "");
} else {
if (content.size()!=0) {
m_paint.fill = parseColor(content);
/*
if (m_paint.fill.a() == 0) {
fillNone = true;
}
*/
}
content = _element->getAttribute("fill-opacity");
if (content.size()!=0) {
@ -384,16 +381,7 @@ void esvg::Base::parsePaintAttr(const std::shared_ptr<const exml::Element>& _ele
m_paint.opacity = parseLength(content);
m_paint.opacity = std::avg(0.0f, m_paint.opacity, 1.0f);
}
// Note : No parsing of 'style' it is already converted in attribute before...
// check if somewere none is set to the filling:
/*
if (fillNone == true) {
m_paint.fill.setA(0.0f);
}
if (strokeNone == true) {
m_paint.stroke.setA(0.0f);
}
*/
}
std::pair<etk::Color<float,4>, std::string> esvg::Base::parseColor(const std::string& _inputData) {
@ -408,7 +396,7 @@ std::pair<etk::Color<float,4>, std::string> esvg::Base::parseColor(const std::st
std::string color(_inputData.begin() + 5, _inputData.end()-1);
localColor = std::pair<etk::Color<float,4>, std::string>(etk::color::none, color);
} else {
ESVG_ERROR(" pb in parsing the color : \"" << _inputData << "\" == > url(XXX) is not supported now ...");
ESVG_ERROR("Problem in parsing the color : \"" << _inputData << "\" == > url(XXX) is not supported now ...");
}
} else {
localColor = std::pair<etk::Color<float,4>, std::string>(_inputData, "");