From 0d59f0f3715f78426bd50dc44feac6f59d674b89 Mon Sep 17 00:00:00 2001 From: Fridrich Štrba Date: Mon, 9 Jan 2012 16:03:46 +0100 Subject: Close the path only if it is really a closed path --- src/lib/VSDXContentCollector.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/VSDXContentCollector.cpp b/src/lib/VSDXContentCollector.cpp index 960a1c2..371e860 100644 --- a/src/lib/VSDXContentCollector.cpp +++ b/src/lib/VSDXContentCollector.cpp @@ -466,6 +466,7 @@ void libvisio::VSDXContentCollector::_flushCurrentPath() double x = 0; double y = 0; bool firstPoint = true; + bool wasMove = false; for (unsigned i = 0; i < m_currentGeometry.size(); i++) { @@ -476,10 +477,11 @@ void libvisio::VSDXContentCollector::_flushCurrentPath() startX = x; startY = y; firstPoint = false; + wasMove = true; } else if (m_currentGeometry[i]["libwpg:path-action"]->getStr() == "M") { - if (((startX == x && startY == y) || (m_styleProps["draw:fill"] && m_styleProps["draw:fill"]->getStr() != "none")) && path.count()) + if ((startX == x && startY == y) && path.count() && !wasMove) { WPXPropertyList closedPath; closedPath.insert("libwpg:path-action", "Z"); @@ -489,15 +491,17 @@ void libvisio::VSDXContentCollector::_flushCurrentPath() y = m_currentGeometry[i]["svg:y"]->getDouble(); startX = x; startY = y; + wasMove = true; } else { x = m_currentGeometry[i]["svg:x"]->getDouble(); y = m_currentGeometry[i]["svg:y"]->getDouble(); + wasMove = false; } path.append(m_currentGeometry[i]); } - if (((startX == x && startY == y) || (m_styleProps["draw:fill"] && m_styleProps["draw:fill"]->getStr() != "none")) && path.count()) + if ((startX == x && startY == y) && path.count() && !wasMove) { WPXPropertyList closedPath; closedPath.insert("libwpg:path-action", "Z"); -- cgit v1.2.3