[Libreoffice-commits] libvisio.git: src/lib

Fridrich Štrba fridrich.strba at bluewin.ch
Tue Dec 29 09:17:38 PST 2015


 src/lib/VSDContentCollector.cpp |   22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

New commits:
commit e5e30daf905fc6d41caa3c50d78ebc66b9e70c05
Author: Fridrich Štrba <fridrich.strba at bluewin.ch>
Date:   Tue Dec 29 18:17:06 2015 +0100

    Try to sort out 0-length path segments
    
    Change-Id: Icaf05be1675850e9b0ff233be0cc4cb5bf86ca6a

diff --git a/src/lib/VSDContentCollector.cpp b/src/lib/VSDContentCollector.cpp
index da6b073..c20e626 100644
--- a/src/lib/VSDContentCollector.cpp
+++ b/src/lib/VSDContentCollector.cpp
@@ -481,8 +481,28 @@ void libvisio::VSDContentCollector::_convertToPath(const std::vector<librevenge:
   }
   else
   {
+    double prevX = DBL_MAX;
+    double prevY = DBL_MAX;
     for (unsigned i = 0; i < segmentVector.size(); ++i)
-      path.append(segmentVector[i]);
+    {
+      if (!segmentVector[i]["librevenge:path-action"])
+        continue;
+      double x = DBL_MAX;
+      double y = DBL_MAX;
+      if (segmentVector[i]["svg:x"] && segmentVector[i]["svg:y"])
+
+      {
+        x = segmentVector[i]["svg:x"]->getDouble();
+        y = segmentVector[i]["svg:y"]->getDouble();
+      }
+      // skip segment that have length 0.0
+      if (!VSD_ALMOST_ZERO(x-prevX) || !VSD_ALMOST_ZERO(y-prevY))
+      {
+        path.append(segmentVector[i]);
+        prevX = x;
+        prevY = y;
+      }
+    }
   }
 }
 


More information about the Libreoffice-commits mailing list