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

List:       kde-commits
Subject:    KDE/kdegraphics/kolourpaint/tools/selection
From:       Clarence Dang <dang () kde ! org>
Date:       2006-11-20 14:41:26
Message-ID: 1164033686.173918.29760.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 606469 by dang:

* Simplify kpToolFreeFormSelection::createMoreSelectionAndUpdateStatusBar()

* Nothing is explicitly shared in Qt anymore


 M  +18 -15    kptoolfreeformselection.cpp  


--- trunk/KDE/kdegraphics/kolourpaint/tools/selection/kptoolfreeformselection.cpp #606468:606469
@@ -58,29 +58,32 @@
 {
     QPolygon points;
 
-    if (document ()->selection ())
-        points = document ()->selection ()->points ();
+    Q_ASSERT (m_dragHasBegun == (bool) document ()->selection ());
 
-
-    // (not detached so will modify "points" directly but
-    //  still need to call kpDocument::setSelection() to
-    //  update screen)
-
+    // First point in drag?
     if (!m_dragHasBegun)
     {
-        // We thought the drag at startPoint was a NOP
-        // but it turns out that it wasn't...
-        points.putPoints (points.count (), 1, m_startPoint.x (), m_startPoint.y ());
+        points.append (m_startPoint);
     }
+    // Not first point in drag.
+    else
+    {
+        // Get existing points in selection.
+        points = document ()->selection ()->points ();
+    }
 
-    // TODO: there should be an upper limit on this before drawing the
-    //       polygon becomes too slow
-    points.putPoints (points.count (), 1, thisPoint.x (), thisPoint.y ());
 
+    // TODO: There should be an upper limit on this before drawing the
+    //       polygon becomes too slow.
+    points.append (thisPoint);
 
-    document ()->setSelection (kpSelection (points, mainWindow ()->selectionTransparency ()));
+
+    document ()->setSelection (
+        kpSelection (points, mainWindow ()->selectionTransparency ()));
 #if DEBUG_KP_TOOL_FREE_FROM_SELECTION && 1
-    kDebug () << "\t\tfreeform; #points=" << document ()->selection ()->points ().count () << endl;
+    kDebug () << "\t\tfreeform; #points="
+              << document ()->selection ()->points ().count ()
+              << endl;
 #endif
 
     setUserShapePoints (m_currentPoint);
[prev in list] [next in list] [prev in thread] [next in thread] 

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