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

Fridrich Å trba fridrich.strba at bluewin.ch
Tue Feb 26 09:47:30 PST 2013


 src/lib/CDRParser.cpp     |   13 +++++++------
 src/lib/CDRTransforms.cpp |    6 +++++-
 2 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 2fd1c6c2939533ab3bf366c113b35d1a038e0e06
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Tue Feb 26 18:47:05 2013 +0100

    Trying to fix some issues with circles

diff --git a/src/lib/CDRParser.cpp b/src/lib/CDRParser.cpp
index a76a0a6..8ba5d0b 100644
--- a/src/lib/CDRParser.cpp
+++ b/src/lib/CDRParser.cpp
@@ -1219,15 +1219,16 @@ void libcdr::CDRParser::readEllipse(WPXInputStream *input)
   }
   else
   {
-    double x0 = cx + rx;
-    double y0 = cy;
+    angle2 += M_PI/2.0;
+    double x0 = cx + rx*cos(angle1);
+    double y0 = cy - ry*sin(angle1);
 
-    double x1 = cx;
-    double y1 = cy - ry;
+    double x1 = cx + rx*cos(angle2);
+    double y1 = cy - ry*sin(angle2);
 
     m_collector->collectMoveTo(x0, y0);
-    m_collector->collectArcTo(rx, ry, false, true, x1, y1);
-    m_collector->collectArcTo(rx, ry, true, true, x0, y0);
+    m_collector->collectArcTo(rx, ry, false, false, x1, y1);
+    m_collector->collectArcTo(rx, ry, true, false, x0, y0);
     m_collector->collectClosePath();
   }
 }
diff --git a/src/lib/CDRTransforms.cpp b/src/lib/CDRTransforms.cpp
index 6b6f27b..9a76a21 100644
--- a/src/lib/CDRTransforms.cpp
+++ b/src/lib/CDRTransforms.cpp
@@ -116,7 +116,11 @@ void libcdr::CDRTransform::applyToArc(double &rx, double &ry, double &rotation,
   }
 
   // sweep is inversed each time the arc is flipped
-  sweep = (m_v0*m_v4 < m_v3*m_v1);
+  if (v0 < 0)
+    sweep = !sweep;
+  if (v4 < 0)
+    sweep = !sweep;
+  
 }
 
 double libcdr::CDRTransform::_getScaleX() const


More information about the Libreoffice-commits mailing list