[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/libs/flake
From:       Cyrille Berger <cyb () lepi ! org>
Date:       2010-10-04 11:15:14
Message-ID: 20101004111514.326EEAC88C () svn ! kde ! org
[Download RAW message or body]

SVN commit 1182369 by berger:

Fix: clicking near a control point might create an infinite shape


 M  +1 -0      commands/KoPathControlPointMoveCommand.cpp  
 M  +8 -1      tools/KoPathSegmentChangeStrategy.cpp  


--- trunk/koffice/libs/flake/commands/KoPathControlPointMoveCommand.cpp #1182368:1182369
@@ -31,6 +31,7 @@
         , m_pointData(pointData)
         , m_pointType(pointType)
 {
+    Q_ASSERT(offset.x() < 1e14 && offset.y() < 1e14);
     KoPathShape * pathShape = m_pointData.pathShape;
     KoPathPoint * point = pathShape->pointByIndex(m_pointData.pointIndex);
     if (point) {
--- trunk/koffice/libs/flake/tools/KoPathSegmentChangeStrategy.cpp #1182368:1182369
@@ -37,7 +37,14 @@
 , m_pointData1(segment)
 , m_pointData2(segment)
 {
-    const qreal eps = std::numeric_limits<qreal>::epsilon();
+    // The following value is a bit arbitrary, it would be more mathematically correct to use
+    // "std::numeric_limits<qreal>::epsilon()", but if the value is too small, when the user
+    // click near a control point it is relatively easy to create a path shape of almost
+    // infinite size, which blocks the application for a long period of time. A bigger value
+    // is mathematically uncorrect, but it avoids to block application, it also avoid to create
+    // an huge path shape by accident, and anyway, but it does not prevent the user to create one
+    // if he choose so.
+    const qreal eps = 1e-2;
     // force segment parameter range to avoid division by zero
     m_segmentParam = qBound(eps, m_segmentParam, qreal(1.0)-eps);
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic