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

List:       kde-commits
Subject:    [krita/rempt/impex-refactoring] libs/ui/tool: Fix bent stabilizer finishing line segment
From:       Alvin Wong <alvinhochun () gmail ! com>
Date:       2016-11-18 19:49:24
Message-ID: E1c7pA4-0005zB-NO () code ! kde ! org
[Download RAW message or body]

Git commit 768c1e6529b84b20a3446d29b765a0d8912144a4 by Alvin Wong.
Committed on 18/11/2016 at 19:48.
Pushed by alvinwong into branch 'rempt/impex-refactoring'.

Fix bent stabilizer finishing line segment

CCBUG: 369349
Maniphest Tasks: T4182

M  +5    -1    libs/ui/tool/kis_stabilized_events_sampler.cpp
M  +3    -3    libs/ui/tool/kis_tool_freehand_helper.cpp

http://commits.kde.org/krita/768c1e6529b84b20a3446d29b765a0d8912144a4

diff --git a/libs/ui/tool/kis_stabilized_events_sampler.cpp \
b/libs/ui/tool/kis_stabilized_events_sampler.cpp index e29701f..e0d1a83 100644
--- a/libs/ui/tool/kis_stabilized_events_sampler.cpp
+++ b/libs/ui/tool/kis_stabilized_events_sampler.cpp
@@ -67,7 +67,11 @@ void KisStabilizedEventsSampler::addEvent(const \
KisPaintInformation &pi)  
 void KisStabilizedEventsSampler::addFinishingEvent(int numSamples)
 {
-    clear();
+    if (m_d->realEvents.size() > 0) {
+        dbgKrita << "DEBUG: KisStabilizedEventsSampler::addFinishingEvent called "
+                    "before `realEvents` is cleared";
+        clear();
+    }
 
     m_d->elapsedTimeOverride = numSamples;
     m_d->realEvents.append(m_d->lastPaintInformation);
diff --git a/libs/ui/tool/kis_tool_freehand_helper.cpp \
b/libs/ui/tool/kis_tool_freehand_helper.cpp index 4347759..0818dfe 100644
--- a/libs/ui/tool/kis_tool_freehand_helper.cpp
+++ b/libs/ui/tool/kis_tool_freehand_helper.cpp
@@ -737,10 +737,10 @@ void KisToolFreehandHelper::stabilizerEnd()
 
     // Finish the line
     if (m_d->smoothingOptions->finishStabilizedCurve()) {
-        // In each iteration we add the latest paint info and delete the oldest
-        // After `sampleSize` iterations the deque will be filled with the latest
-        // value and we will have reached the end point.
+        // Process all the existing events first
+        stabilizerPollAndPaint();
 
+        // Draw the finish line with pending events and a time override
         m_d->stabilizedSampler.addFinishingEvent(m_d->stabilizerDeque.size());
         stabilizerPollAndPaint();
     }


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

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