From 423fa82e2f2a0b4695f60cf42202c29345d043a4 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Wed, 25 Apr 2012 18:48:04 +0200 Subject: [PATCH] Remove some error in the svg parser --- Sources/libparsersvg/parserSVG/Base.cpp | 9 +++- Sources/libparsersvg/parserSVG/Path.cpp | 56 +++++++++++++++++++- Sources/libparsersvg/parserSVG/parserSVG.cpp | 1 + 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/Sources/libparsersvg/parserSVG/Base.cpp b/Sources/libparsersvg/parserSVG/Base.cpp index 989580e7..743f008d 100644 --- a/Sources/libparsersvg/parserSVG/Base.cpp +++ b/Sources/libparsersvg/parserSVG/Base.cpp @@ -291,27 +291,32 @@ void svg::Base::ParsePaintAttr(const TiXmlNode *node) for( const char *sss=extractPartOfStyle(content, outputType, outputValue, 1024); NULL != sss; sss=extractPartOfStyle(sss, outputType, outputValue, 1024) ) { - //SVG_INFO(" style parse : \"" << outputType << "\" with value : \"" << outputValue << "\""); + SVG_INFO(" style parse : \"" << outputType << "\" with value : \"" << outputValue << "\""); if (0 == strcmp(outputType, "fill") ) { m_paint.fill = ParseColor(outputValue); + SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.fill); } else if (0 == strcmp(outputType, "stroke") ) { m_paint.stroke = ParseColor(outputValue); + SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.stroke); } else if (0 == strcmp(outputType, "stroke-width") ) { m_paint.strokeWidth = ParseLength(outputValue); - //SVG_ERROR(" input : \"" << outputValue << "\" ==> " < " << m_paint.strokeWidth); } else if (0 == strcmp(outputType, "opacity") ) { etkFloat_t opacity = ParseLength(outputValue); opacity = etk_max(0.0, etk_min(1.0, opacity)); m_paint.fill.alpha = opacity*0xFF; m_paint.stroke.alpha = opacity*0xFF; + SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.fill); } else if (0 == strcmp(outputType, "fill-opacity") ) { etkFloat_t opacity = ParseLength(outputValue); opacity = etk_max(0.0, etk_min(1.0, opacity)); m_paint.fill.alpha = opacity*0xFF; + SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.fill); } else if (0 == strcmp(outputType, "stroke-opacity") ) { etkFloat_t opacity = ParseLength(outputValue); opacity = etk_max(0.0, etk_min(1.0, opacity)); m_paint.stroke.alpha = opacity*0xFF; + SVG_ERROR(" input : \"" << outputValue << "\" ==> " << m_paint.stroke); } else if (0 == strcmp(outputType, "fill-rule") ) { if (0 == strcmp(outputValue, "nonzero") ) { m_paint.flagEvenOdd = false; diff --git a/Sources/libparsersvg/parserSVG/Path.cpp b/Sources/libparsersvg/parserSVG/Path.cpp index fb4e9c6a..6f5414a0 100644 --- a/Sources/libparsersvg/parserSVG/Path.cpp +++ b/Sources/libparsersvg/parserSVG/Path.cpp @@ -128,7 +128,13 @@ bool svg::Path::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, coord2D_ break; } pathElement.cmd = svg::PATH_ENUM_MOVETO; - for(int32_t iii=0; iii= 2) { + pathElement.element[0] = listDot[0]; + pathElement.element[1] = listDot[1]; + m_listElement.PushBack(pathElement); + } + pathElement.cmd = svg::PATH_ENUM_LINETO; + for(int32_t iii=2; iii