Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

fixed the blockers

Ken Lo273d2bc0127a
diff --git a/libs/ui/tool/kis_tool_freehand_helper.cpp b/libs/ui/tool/kis_tool_freehand_helper.cpp
index 908001ea5a..88441714d2 100644
--- a/libs/ui/tool/kis_tool_freehand_helper.cpp
+++ b/libs/ui/tool/kis_tool_freehand_helper.cpp
@@ -480,7 +480,8 @@ void KisToolFreehandHelper::paint(KisPaintInformation &info)
*/
KisPaintInformation lastUsedPaintInformation;
- QPointF currentPixel = info.pos();
+ QPointF currentPixelPos = info.pos();
+ const float PIXEL_DISTANCE_THRESHOLD = 1.7;
if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::WEIGHTED_SMOOTHING
@@ -612,38 +613,39 @@ void KisToolFreehandHelper::paint(KisPaintInformation &info)
if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::PIXEL_PERFECT) {
// initial case: No last drawn pixel or waiting pixel
- if(!m_d->hasLastDrawnPixel){
- currentPixel = info.pos();
- m_d->waitingPixel = currentPixel;
+ if(!m_d->hasLastDrawnPixel) {
+ currentPixelPos = info.pos();
+ m_d->waitingPixel = currentPixelPos;
+
paintLine(m_d->previousPaintInformation, KisPaintInformation(m_d->waitingPixel));
m_d->lastDrawnPixel = m_d->waitingPixel;
m_d->hasLastDrawnPixel = true;
m_d->pixelInLineCount = 1;
} else {
- if (abs(currentPixel.x() - m_d->lastDrawnPixel.x()) > 1.7 || abs(currentPixel.y() - m_d->lastDrawnPixel.y()) > 1.7) {
- if(m_d->hasLastDrawnPixel){
+ if (abs(currentPixelPos.x() - m_d->lastDrawnPixel.x()) > PIXEL_DISTANCE_THRESHOLD || abs(currentPixelPos.y() - m_d->lastDrawnPixel.y()) > PIXEL_DISTANCE_THRESHOLD) {
+ if(m_d->hasLastDrawnPixel) {
m_d->pixelInLineCount = 1;
}
// current pixel is too far, draw the waiting pixel
paintLine(m_d->lastDrawnPixel, KisPaintInformation(m_d->waitingPixel));
m_d->pixelInLineCount += 2;
m_d->lastDrawnPixel = m_d->waitingPixel;
- m_d->waitingPixel = currentPixel;
+ m_d->waitingPixel = currentPixelPos;
}
// check axis, if the currentpixel is in the same axis as the lastdrawnpixel, we can draw waiting pixel
- if (m_d->pixelInLineCount > 2 && (currentPixel.x() == m_d->lastDrawnPixel.x() || currentPixel.y() == m_d->lastDrawnPixel.y())) {
- paintLine(m_d->lastDrawnPixel, KisPaintInformation(m_d->waitingPixel));
- m_d->lastDrawnPixel = m_d->waitingPixel;
- m_d->olderPaintInformation = m_d->previousPaintInformation;
+ if (m_d->pixelInLineCount > 2 && (currentPixelPos.x() == m_d->lastDrawnPixel.x() || currentPixelPos.y() == m_d->lastDrawnPixel.y())) {
+ paintLine(m_d->lastDrawnPixel, KisPaintInformation(m_d->waitingPixel));
+ m_d->lastDrawnPixel = m_d->waitingPixel;
+ m_d->olderPaintInformation = m_d->previousPaintInformation;
}
else{
//otherwise just change update waiting pixel without drawing it, this is the scenario where we just skip a corner and therefore we also reset pixelInLineCount
- m_d->waitingPixel = currentPixel;
+ m_d->waitingPixel = currentPixelPos;
m_d->pixelInLineCount = 0;
}
// Enable stroke timeout only when not airbrushing.
if (!m_d->airbrushingTimer.isActive()) {
- m_d->strokeTimeoutTimer.start(100);
+ m_d->strokeTimeoutTimer.start(100);
}
}
}
@@ -846,10 +848,8 @@ void KisToolFreehandHelper::stabilizerPollAndPaint()
KisPaintInformation newInfo = getStabilizedPaintInfo(m_d->stabilizerDeque, sampledInfo);
if (m_d->stabilizerDelayedPaintHelper.running()) {
- //qDebug() << "if in stablizer reached new infopos: " << newInfo.pos();
delayedPaintTodoItems.append(newInfo);
} else {
- //qDebug() << "else in stablizer reached new infopos: " << newInfo.pos();
paintLine(m_d->previousPaintInformation, newInfo);
}
m_d->previousPaintInformation = newInfo;
@@ -858,7 +858,6 @@ void KisToolFreehandHelper::stabilizerPollAndPaint()
m_d->stabilizerDeque.dequeue();
m_d->stabilizerDeque.enqueue(sampledInfo);
} else if (m_d->stabilizerDeque.head().pos() != m_d->previousPaintInformation.pos()) {
- //qDebug() << "else if : " << m_d->stabilizerDeque.head().pos();
QQueue<KisPaintInformation>::iterator it = m_d->stabilizerDeque.begin();
QQueue<KisPaintInformation>::iterator end = m_d->stabilizerDeque.end();
@@ -886,13 +885,11 @@ void KisToolFreehandHelper::stabilizerEnd()
// Finish the line
if (m_d->smoothingOptions->finishStabilizedCurve()) {
// Process all the existing events first
- //stabilizerPollAndPaint();
- //pixelPerfectLinePainter();
+ stabilizerPollAndPaint();
// Draw the finish line with pending events and a time override
m_d->stabilizedSampler.addFinishingEvent(m_d->stabilizerDeque.size());
- //stabilizerPollAndPaint();
- //pixelPerfectLinePainter();
+ stabilizerPollAndPaint();
}
if (m_d->stabilizerDelayedPaintHelper.running()) {
@@ -999,7 +996,6 @@ void KisToolFreehandHelper::paintBezierCurve(int strokeInfoId,
const KisPaintInformation &pi2)
{
- //qDebug() << "paintBezierCurve: " << pi1.pos() <<", " << pi2.pos() ;
#ifdef DEBUG_BEZIER_CURVES
KisPaintInformation tpi1;
KisPaintInformation tpi2;
diff --git a/plugins/tools/basictools/kis_tool_brush.cc b/plugins/tools/basictools/kis_tool_brush.cc
index 9985d21f7a..e699298a6a 100644
--- a/plugins/tools/basictools/kis_tool_brush.cc
+++ b/plugins/tools/basictools/kis_tool_brush.cc
@@ -519,7 +519,7 @@ QList<QAction *> KisToolBrushFactory::createActionsImpl()
QList<QAction *> actions = KisToolPaintFactoryBase::createActionsImpl();
actions << actionRegistry->makeQAction("set_no_brush_smoothing", this);
- actions << actionRegistry->makeQAction("set_simple_brush_smoothing", this);
+ actions << actionRegistry->makeQAction("set_simple_pixel_smoothing", this);
actions << actionRegistry->makeQAction("set_weighted_brush_smoothing", this);
actions << actionRegistry->makeQAction("set_stabilizer_brush_smoothing", this);
actions << actionRegistry->makeQAction("toggle_assistant", this);