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++
Cleaned up previous work/comments/qDebugs
Ken Lo70d4cc19a89f
diff --git a/libs/image/brushengine/kis_paintop.cc b/libs/image/brushengine/kis_paintop.ccindex b3d3ec5712..8107738871 100644--- a/libs/image/brushengine/kis_paintop.cc+++ b/libs/image/brushengine/kis_paintop.cc@@ -102,7 +102,6 @@ static void paintBezierCurve(KisPaintOp *paintOp,const KisPaintInformation &pi2,KisDistanceInformation *currentDistance)- //const std::vector<QPoint>& smoothedPoints{LineEquation line = LineEquation::Through(toKisVector2D(pi1.pos()), toKisVector2D(pi2.pos()));qreal d1 = line.absDistance(control1);@@ -110,11 +109,8 @@ static void paintBezierCurve(KisPaintOp *paintOp,if ((d1 < BEZIER_FLATNESS_THRESHOLD && d2 < BEZIER_FLATNESS_THRESHOLD)|| qIsNaN(d1) || qIsNaN(d2)) {- //qDebug() << "kis_paintop:paintBeziercurve -> paintline"; this one- //qDebug() << "kis_paintop bezier curve" << "pi1: " << pi1 << "pi2: " << pi2 << "currentDistance" << currentDistance;paintOp->paintLine(pi1, pi2, currentDistance);} else {- //qDebug() << "kis_paintop:paintBeziercurve -> else";// Midpoint subdivision. See Foley & Van Dam Computer Graphics P.508KisVector2D l2 = (toKisVector2D(pi1.pos()) + control1) / 2;KisVector2D h = (control1 + control2) / 2;@@ -144,7 +140,6 @@ void KisPaintOp::paintLine(const KisPaintInformation &pi1,const KisPaintInformation &pi2,KisDistanceInformation *currentDistance){- //qDebug()<< "KisPaintOp::paintLine";KisPaintOpUtils::paintLine(*this, pi1, pi2, currentDistance,d->fanCornersEnabled,d->fanCornersStep);@@ -153,7 +148,6 @@ void KisPaintOp::paintLine(const KisPaintInformation &pi1,void KisPaintOp::paintAt(const KisPaintInformation& info, KisDistanceInformation *currentDistance){Q_ASSERT(currentDistance);- qDebug()<< "kis_paintop::paintAt";KisPaintInformation pi(info);pi.paintAt(*this, currentDistance);}diff --git a/libs/image/brushengine/kis_paintop.h b/libs/image/brushengine/kis_paintop.hindex 6c7c46ae19..d3c1b3c54d 100644--- a/libs/image/brushengine/kis_paintop.h+++ b/libs/image/brushengine/kis_paintop.h@@ -86,7 +86,6 @@ public:const KisPaintInformation &pi2,KisDistanceInformation *currentDistance);- //const std::vector<QPoint>& smoothedPoints/*** Whether this paintop can paint. Can be false in case that some setting isn't read correctly.diff --git a/libs/image/kis_painter.cc b/libs/image/kis_painter.ccindex 92e2efaa80..5d491c5c64 100644--- a/libs/image/kis_painter.cc+++ b/libs/image/kis_painter.cc@@ -1153,7 +1153,6 @@ void KisPainter::paintLine(const KisPaintInformation &pi1,const KisPaintInformation &pi2,KisDistanceInformation *currentDistance){- //qDebug()<< "kis_painter::paintLine";if (d->device && d->paintOp && d->paintOp->canPaint()) {d->paintOp->paintLine(pi1, pi2, currentDistance);}@@ -1240,7 +1239,6 @@ void KisPainter::paintBezierCurve(const KisPaintInformation &pi1,const KisPaintInformation &pi2,KisDistanceInformation *currentDistance){- //qDebug() << "KisPainter::paintBezierCurve";if (d->paintOp && d->paintOp->canPaint()) {d->paintOp->paintBezierCurve(pi1, control1, control2, pi2, currentDistance);}@@ -1638,7 +1636,6 @@ void KisPainter::drawPainterPath(const QPainterPath& path, const QPen& _pen, coninline void KisPainter::compositeOnePixel(quint8 *dst, const KoColor &color){- //qDebug()<< "kis_painter compositeOnePixel";d->paramInfo.dstRowStart = dst;d->paramInfo.dstRowStride = 0;d->paramInfo.srcRowStart = color.data();@@ -1655,7 +1652,6 @@ inline void KisPainter::compositeOnePixel(quint8 *dst, const KoColor &color)/**/void KisPainter::drawLine(const QPointF& start, const QPointF& end, qreal width, bool antialias){- //qDebug()<< "kis_painter::drawLine";int x1 = qFloor(start.x());int y1 = qFloor(start.y());int x2 = qFloor(end.x());@@ -1742,7 +1738,6 @@ void KisPainter::drawLine(const QPointF & start, const QPointF & end)drawThickLine(start, end, 1, 1);}-//original drawDDALinevoid KisPainter::drawDDALine(const QPointF & start, const QPointF & end){int x = qFloor(start.x());@@ -1750,8 +1745,6 @@ void KisPainter::drawDDALine(const QPointF & start, const QPointF & end)int x2 = qFloor(end.x());int y2 = qFloor(end.y());- //qDebug() << " start: " << x <<" start " << x2 << " y: " << y << " y2 " << y2 ;- qDebug() << "drawDDAlinepainter x: " << x <<" x2 " << x2 << " y: " << y << " y2 " << y2 ;// Width and height of the lineint xd = x2 - x;int yd = y2 - y;@@ -1785,7 +1778,6 @@ void KisPainter::drawDDALine(const QPointF & start, const QPointF & end)}if (fabs(m) > 1.0f) {- //qDebug() << "fabs in kis_painter";inc = (yd > 0) ? 1 : -1;m = (lockAxis)? 0 : 1.0f / m;m *= inc;@@ -1802,7 +1794,6 @@ void KisPainter::drawDDALine(const QPointF & start, const QPointF & end)}}} else {- //qDebug() << "not fabs in kis_painter";inc = (xd > 0) ? 1 : -1;m *= inc;while (x != x2) {@@ -1820,328 +1811,6 @@ void KisPainter::drawDDALine(const QPointF & start, const QPointF & end)}}-// void KisPainter::drawDDALine(const QPointF & start, const QPointF & end)-// {-// static QPoint lastDrawnPixel(-1, -1);-// static QPoint waitingPixel(-1, -1);--// int x = qFloor(start.x());-// int y = qFloor(start.y());--// int x2 = qFloor(end.x());-// int y2 = qFloor(end.y());--// int xd = x2 - x;-// int yd = y2 - y;--// float m = 0;-// bool lockAxis = true;--// if (xd == 0) {-// m = 2.0;-// } else if (yd != 0) {-// lockAxis = false;-// m = (float)yd / (float)xd;-// }--// float fx = x;-// float fy = y;-// int inc;--// KisRandomAccessorSP accessor = d->device->createRandomAccessorNG();-// KisRandomConstAccessorSP selectionAccessor;-// if (d->selection) {-// selectionAccessor = d->selection->projection()->createRandomConstAccessorNG();-// }--// QPoint currentPixel(x, y);--// auto drawPixel = [&](int x, int y) {-// accessor->moveTo(x, y);-// if (selectionAccessor) selectionAccessor->moveTo(x, y);--// if (!selectionAccessor || *selectionAccessor->oldRawData() > SELECTION_THRESHOLD) {-// compositeOnePixel(accessor->rawData(), d->paintColor);-// qDebug() << "Drawing pixel at: " << x << ", " << y;-// }-// };--// // for the first pixel if its not drawn yet-// if (lastDrawnPixel == QPoint(-1, -1)) {-// drawPixel(x, y);-// lastDrawnPixel = QPoint(x, y);-// waitingPixel = QPoint(-1, -1);-// }--// if (fabs(m) > 1.0f) {-// inc = (yd > 0) ? 1 : -1;-// m = (lockAxis) ? 0 : 1.0f / m;-// m *= inc;-// while (y != y2) {-// y += inc;-// fx += m;-// x = qRound(fx);--// currentPixel = QPoint(x, y);-// if (currentPixel == lastDrawnPixel) continue;--// if (waitingPixel == QPoint(-1, -1)) {-// waitingPixel = currentPixel;-// } else {-// QPoint dir = currentPixel - lastDrawnPixel;-// QPoint waitingDir = waitingPixel - lastDrawnPixel;--// if (dir == waitingDir) {-// drawPixel(waitingPixel.x(), waitingPixel.y());-// lastDrawnPixel = waitingPixel;-// waitingPixel = currentPixel;-// } else {-// waitingPixel = currentPixel;-// }-// }-// }-// } else {-// inc = (xd > 0) ? 1 : -1;-// m *= inc;-// while (x != x2) {-// x += inc;-// fy += m;-// y = qRound(fy);--// currentPixel = QPoint(x, y);-// if (currentPixel == lastDrawnPixel) continue;--// if (waitingPixel == QPoint(-1, -1)) {-// waitingPixel = currentPixel;-// } else {-// QPoint dir = currentPixel - lastDrawnPixel;-// QPoint waitingDir = waitingPixel - lastDrawnPixel;--// if (dir == waitingDir) {-// drawPixel(waitingPixel.x(), waitingPixel.y());-// lastDrawnPixel = waitingPixel;-// waitingPixel = currentPixel;-// } else {-// waitingPixel = currentPixel;-// }-// }-// }-// }--// if (x == x2 && y == y2) {-// lastDrawnPixel = QPoint(-1, -1);-// waitingPixel = QPoint(-1, -1);-// }-// }--// void KisPainter::drawDDALine(const QPointF & start, const QPointF & end)-// {-// static QPoint lastDrawnPixel(-1, -1);-// static QPoint waitingPixel(-1, -1);--// int x = qFloor(start.x());-// int y = qFloor(start.y());--// int x2 = qFloor(end.x());-// int y2 = qFloor(end.y());--// int xd = x2 - x;-// int yd = y2 - y;--// float m = 0;-// bool lockAxis = true;--// if (xd == 0) {-// m = 2.0;-// } else if (yd != 0) {-// lockAxis = false;-// m = (float)yd / (float)xd;-// }--// float fx = x;-// float fy = y;-// int inc;--// KisRandomAccessorSP accessor = d->device->createRandomAccessorNG();-// KisRandomConstAccessorSP selectionAccessor;-// if (d->selection) {-// selectionAccessor = d->selection->projection()->createRandomConstAccessorNG();-// }--// QPoint currentPixel(x, y);--// auto drawPixel = [&](int x, int y) {-// accessor->moveTo(x, y);-// if (selectionAccessor) selectionAccessor->moveTo(x, y);--// if (!selectionAccessor || *selectionAccessor->oldRawData() > SELECTION_THRESHOLD) {-// compositeOnePixel(accessor->rawData(), d->paintColor);-// qDebug() << "Drawing pixel at: " << x << ", " << y;-// }-// };--// if (lastDrawnPixel == QPoint(-1, -1)) {-// drawPixel(x, y);-// lastDrawnPixel = QPoint(x, y);-// waitingPixel = QPoint(-1, -1);-// }--// if (fabs(m) > 1.0f) {-// inc = (yd > 0) ? 1 : -1;-// m = (lockAxis) ? 0 : 1.0f / m;-// m *= inc;-// while (y != y2) {-// y += inc;-// fx += m;-// x = qRound(fx);--// currentPixel = QPoint(x, y);-// if (currentPixel == lastDrawnPixel) continue;--// if (waitingPixel == QPoint(-1, -1)) {-// waitingPixel = currentPixel;-// } else {-// QPoint dir = currentPixel - lastDrawnPixel;-// QPoint waitingDir = waitingPixel - lastDrawnPixel;--// if (dir == waitingDir) {-// drawPixel(waitingPixel.x(), waitingPixel.y());-// lastDrawnPixel = waitingPixel;-// waitingPixel = currentPixel;-// } else {-// waitingPixel = currentPixel;-// }-// }-// }-// } else {-// inc = (xd > 0) ? 1 : -1;-// m *= inc;-// while (x != x2) {-// x += inc;-// fy += m;-// y = qRound(fy);--// currentPixel = QPoint(x, y);-// if (currentPixel == lastDrawnPixel) continue;--// if (waitingPixel == QPoint(-1, -1)) {-// waitingPixel = currentPixel;-// } else {-// QPoint dir = currentPixel - lastDrawnPixel;-// QPoint waitingDir = waitingPixel - lastDrawnPixel;--// if (dir == waitingDir) {-// drawPixel(waitingPixel.x(), waitingPixel.y());-// lastDrawnPixel = waitingPixel;-// waitingPixel = currentPixel;-// } else {-// waitingPixel = currentPixel;-// }-// }-// }-// }--// // Reset static variables after completing the stroke-// if (x == x2 && y == y2) {-// lastDrawnPixel = QPoint(-1, -1);-// waitingPixel = QPoint(-1, -1);-// }-// }--// void KisPainter::drawDDALine(const QPointF & start, const QPointF & end) {-// int x = qFloor(start.x());-// int y = qFloor(start.y());--// int x2 = qFloor(end.x());-// int y2 = qFloor(end.y());--// int xd = x2 - x;-// int yd = y2 - y;--// float m = 0;-// bool lockAxis = true;--// if (xd == 0) {-// m = 2.0;-// } else if (yd != 0) {-// lockAxis = false;-// m = static_cast<float>(yd) / static_cast<float>(xd);-// }--// float fx = x;-// float fy = y;-// int inc;--// KisRandomAccessorSP accessor = d->device->createRandomAccessorNG();-// KisRandomConstAccessorSP selectionAccessor;-// if (d->selection) {-// selectionAccessor = d->selection->projection()->createRandomConstAccessorNG();-// }--// accessor->moveTo(x, y);-// if (selectionAccessor) selectionAccessor->moveTo(x, y);--// if (!selectionAccessor || *selectionAccessor->oldRawData() > SELECTION_THRESHOLD) {-// compositeOnePixel(accessor->rawData(), d->paintColor);-// }--// QPoint lastDrawnPixel(x, y);-// QPoint waitingPixel(x, y);-// QPoint currentPixel(x, y);--// auto drawPixel = [&](int px, int py) {-// accessor->moveTo(px, py);-// if (selectionAccessor) selectionAccessor->moveTo(px, py);--// if (!selectionAccessor || *selectionAccessor->oldRawData() > SELECTION_THRESHOLD) {-// compositeOnePixel(accessor->rawData(), d->paintColor);-// qDebug() << "Drawing pixel at: " << x << ", " << y;-// }-// };--// if (fabs(m) > 1.0f) {-// inc = (yd > 0) ? 1 : -1;-// m = (lockAxis) ? 0 : 1.0f / m;-// m *= inc;-// while (y != y2) {-// y = y + inc;-// fx = fx + m;-// x = qRound(fx);--// currentPixel = QPoint(x, y);-// if ((abs(currentPixel.x() - lastDrawnPixel.x()) > 1) || (abs(currentPixel.y() - lastDrawnPixel.y()) > 1)) {-// drawPixel(waitingPixel.x(), waitingPixel.y());-// lastDrawnPixel = waitingPixel;-// waitingPixel = currentPixel;-// } else if ((abs(currentPixel.x() - waitingPixel.x()) > 1) || (abs(currentPixel.y() - waitingPixel.y()) > 1)) {-// waitingPixel = currentPixel;-// }-// }-// } else {-// inc = (xd > 0) ? 1 : -1;-// m *= inc;-// while (x != x2) {-// x = x + inc;-// fy = fy + m;-// y = qRound(fy);--// currentPixel = QPoint(x, y);-// if ((abs(currentPixel.x() - lastDrawnPixel.x()) > 1) || (abs(currentPixel.y() - lastDrawnPixel.y()) > 1)) {-// drawPixel(waitingPixel.x(), waitingPixel.y());-// lastDrawnPixel = waitingPixel;-// waitingPixel = currentPixel;-// } else if ((abs(currentPixel.x() - waitingPixel.x()) > 1) || (abs(currentPixel.y() - waitingPixel.y()) > 1)) {-// waitingPixel = currentPixel;-// }-// }-// }--// drawPixel(waitingPixel.x(), waitingPixel.y());-// }---//qDebug() << " x: " << x << " y: " << y << " x2 " << x2 << " y2 " << y2 ;-void KisPainter::drawWobblyLine(const QPointF & start, const QPointF & end){KoColor mycolor(d->paintColor);diff --git a/libs/image/kis_painter.h b/libs/image/kis_painter.hindex 72b4d30f66..818c4f47d5 100644--- a/libs/image/kis_painter.h+++ b/libs/image/kis_painter.h@@ -464,10 +464,10 @@ public:* because the currently set brush has a spacing greater than that distance.*/void paintBezierCurve(const KisPaintInformation &pi1,- const QPointF &control1,- const QPointF &control2,- const KisPaintInformation &pi2,- KisDistanceInformation *currentDistance) ;+ const QPointF &control1,+ const QPointF &control2,+ const KisPaintInformation &pi2,+ KisDistanceInformation *currentDistance);/*** Fill the given vector points with the points needed to draw the Bezier curve betweendiff --git a/libs/ui/canvas/kis_tool_proxy.cpp b/libs/ui/canvas/kis_tool_proxy.cppindex 9d4d3f3b27..c41513ac04 100644--- a/libs/ui/canvas/kis_tool_proxy.cpp+++ b/libs/ui/canvas/kis_tool_proxy.cpp@@ -170,7 +170,6 @@ void KisToolProxy::forwardToTool(ActionState state, KisTool::ToolAction action,if (event->type() == QEvent::MouseButtonDblClick) {activeTool->beginPrimaryDoubleClickAction(&ev);} else {- //qDebug() << "kis_tool_proxy in forwardToTool";activeTool->beginPrimaryAction(&ev);}} else {diff --git a/libs/ui/tool/kis_tool_freehand.cc b/libs/ui/tool/kis_tool_freehand.ccindex 41c70b3945..5a510f971a 100644--- a/libs/ui/tool/kis_tool_freehand.cc+++ b/libs/ui/tool/kis_tool_freehand.cc@@ -10,9 +10,6 @@*/#include "kis_tool_freehand.h"-//#include "../../../plugins/paintops/defaultpaintops/brush/kis_brushop.h"-//#include <../../../plugins/paintops/defaultpaintops/brush/kis_brushop.>-//#include "plugins/paintops/defaultpaintops/brush/kis_brushop.h"#include <QPainter>#include <QRect>#include <QThreadPool>@@ -52,7 +49,6 @@#include "kis_tool_freehand_helper.h"#include "strokes/freehand_stroke.h"#include "kis_tool_utils.h"-//#include "smoothedpointsmanager.h"using namespace std::placeholders; // For _1 placeholder@@ -173,143 +169,26 @@ void KisToolFreehand::deactivate()}KisToolPaint::deactivate();}-//original-// void KisToolFreehand::initStroke(KoPointerEvent *event)-// {-// //qDebug() << "KisToolFreehand:initStroke";-// m_helper->initPaint(event,-// convertToPixelCoord(event),-// image(),-// currentNode(),-// image().data());-// }--// void KisToolFreehand::initStroke(KoPointerEvent *event)-// {-// // qDebug() << "KisToolFreehand:initStroke";-// // qDebug() << "Event Position (global):" << event->globalPos();-// // qDebug() << "Event Position (widget):" << event->pos();-// // qDebug() << "Event Document Coordinates:" << event->point;-// // qDebug() << "Event Pressure:" << event->pressure();-// // qDebug() << "Event Rotation:" << event->rotation();-// // qDebug() << "Event Tangential Pressure:" << event->tangentialPressure();-// // qDebug() << "Event xTilt:" << event->xTilt();-// // qDebug() << "Event yTilt:" << event->yTilt();-// // qDebug() << "Event z Position:" << event->z();-// // qDebug() << "Event Time:" << event->time();-// // qDebug() << "Event isTabletEvent:" << event->isTabletEvent();--// m_helper->initPaint(event,-// convertToPixelCoord(event),-// image(),-// currentNode(),-// image().data());-// }void KisToolFreehand::initStroke(KoPointerEvent *event){- qDebug() << "KisToolFreehand:initStroke";m_helper->initPaint(event,convertToPixelCoord(event),image(),currentNode(),image().data());-- strokeCoordinates.clear();- strokeCoordinates.push_back(convertToPixelCoord(event));}-//original-// void KisToolFreehand::doStroke(KoPointerEvent *event)-// {-// m_helper->paintEvent(event);-// }-void KisToolFreehand::doStroke(KoPointerEvent *event){- // qDebug() << "KisToolFreehand:doStroke";m_helper->paintEvent(event);-- strokeCoordinates.push_back(convertToPixelCoord(event)); // Track the coordinates}-// void KisToolFreehand::doStroke(KoPointerEvent *event)-// {-// // qDebug() << "KisToolFreehand:doStroke";-// m_helper->paintEvent(event, m_smoothedPoints);--// strokeCoordinates.push_back(convertToPixelCoord(event)); // Track the coordinates-// }--//original-// void KisToolFreehand::endStroke()-// {-// //qDebug() << "KisToolFreehand:endStroke";-// m_helper->endPaint();-// bool paintOpIgnoredEvent = currentPaintOpPreset()->settings()->mouseReleaseEvent();-// Q_UNUSED(paintOpIgnoredEvent);-// }--void KisToolFreehand::endStroke(){- qDebug() << "KisToolFreehand:endStroke";m_helper->endPaint();bool paintOpIgnoredEvent = currentPaintOpPreset()->settings()->mouseReleaseEvent();Q_UNUSED(paintOpIgnoredEvent);-- std::vector<QPoint> points;- for (const QPointF& point : strokeCoordinates) {- QPoint intPoint = point.toPoint(); //convert QPointF to QPoint- points.push_back(intPoint);- }-- std::vector<QPoint> uniquePoints = removeDuplicates(points);-- std::vector<QPoint> smoothedPoints = removeLShapes(uniquePoints);-- // for (const QPoint& point : smoothedPoints) {- // qDebug() << "Smoothed Stroke Point (Integer):" << point.x() << point.y();- // }-- //KisBrushOp::smoothedPoints = smoothedPoints;- // KisBrushOp* brushOp = dynamic_cast<KisBrushOp*>(currentPaintOp());- // if (brushOp) {- // brushOp->setSmoothedPoints(smoothedPoints);- // }- m_smoothedPoints = smoothedPoints;-- // for (const QPoint& point : m_smoothedPoints) {- // qDebug() << "Smoothed Stroke Point (Integer):" << point.x() << point.y();- // }--- strokeCoordinates.clear();-}--std::vector<QPoint> KisToolFreehand::removeDuplicates(const std::vector<QPoint>& points) {- std::vector<QPoint> uniquePoints;- for (const auto& point : points) {- if (uniquePoints.empty() || uniquePoints.back() != point) {- uniquePoints.push_back(point);- }- }- return uniquePoints;-}--std::vector<QPoint> KisToolFreehand::removeLShapes(const std::vector<QPoint>& points) {- std::vector<QPoint> smoothedPoints;- for (size_t c = 0; c < points.size(); ++c) {- if (c > 0 && c + 1 < points.size() &&- (points[c - 1].x() == points[c].x() || points[c - 1].y() == points[c].y()) &&- (points[c + 1].x() == points[c].x() || points[c + 1].y() == points[c].y()) &&- points[c - 1].x() != points[c + 1].x() &&- points[c - 1].y() != points[c + 1].y()) {- continue;- }- smoothedPoints.push_back(points[c]);- }- return smoothedPoints;}bool KisToolFreehand::primaryActionSupportsHiResEvents() constdiff --git a/libs/ui/tool/kis_tool_freehand.h b/libs/ui/tool/kis_tool_freehand.hindex 60fb48d2df..8dae61d7ca 100644--- a/libs/ui/tool/kis_tool_freehand.h+++ b/libs/ui/tool/kis_tool_freehand.h@@ -35,8 +35,6 @@ public:~KisToolFreehand() override;int flags() const override;void mouseMoveEvent(KoPointerEvent *event) override;- //const std::vector<QPoint>& getSmoothedPoints() const { return smoothedPoints; }- std::vector<QPoint> m_smoothedPoints;public Q_SLOTS:@@ -65,10 +63,6 @@ protected:virtual void doStroke(KoPointerEvent *event);virtual void endStroke();- //extern std::vector<QPointF> strokeCoordinates;- std::vector<QPointF> strokeCoordinates;- std::vector<QPoint> removeDuplicates(const std::vector<QPoint>& points);- std::vector<QPoint> removeLShapes(const std::vector<QPoint>& points);KisOptimizedBrushOutline getOutlinePath(const QPointF &documentPos,diff --git a/libs/ui/tool/kis_tool_freehand_helper.cpp b/libs/ui/tool/kis_tool_freehand_helper.cppindex 7983b0f035..908001ea5a 100644--- a/libs/ui/tool/kis_tool_freehand_helper.cpp+++ b/libs/ui/tool/kis_tool_freehand_helper.cpp@@ -343,7 +343,6 @@ KoCanvasResourceProvider *KisToolFreehandHelper::resourceManager() constvoid KisToolFreehandHelper::paintBezierSegment(KisPaintInformation pi1, KisPaintInformation pi2,QPointF tangent1, QPointF tangent2){- //qDebug() <<"KisToolfreehandhelper: paintBezierSegement :" << qFloor(pi1.pos().x()) <<" "<< qFloor(pi1.pos().y())<<" "<< qFloor(pi2.pos().x()) <<" "<< qFloor(pi2.pos().y());if (tangent1.isNull() || tangent2.isNull()) return;const qreal maxSanePoint = 1e6;@@ -457,224 +456,9 @@ void KisToolFreehandHelper::paintEvent(KoPointerEvent *event)paint(info);}-//original + filter-// void KisToolFreehandHelper::paint(KisPaintInformation &info)-// {-// //qDebug()<< "kis_tool_freehand_helper::paint";-// /**-// * Smooth the coordinates out using the history and the-// * distance. This is a heavily modified version of an algo used in-// * Gimp and described in https://bugs.kde.org/show_bug.cgi?id=281267 and-// * https://w.atwiki.jp/sigetch_2007/pages/17.html. The main-// * differences are:-// *-// * 1) It uses 'distance' instead of 'velocity', since time-// * measurements are too unstable in realworld environment-// *-// * 2) There is no 'Quality' parameter, since the number of samples-// * is calculated automatically-// *-// * 3) 'Tail Aggressiveness' is used for controlling the end of the-// * stroke-// *-// * 4) The formula is a little bit different: 'Distance' parameter-// * stands for $3 \Sigma$-// */-// // QPointF startPoint = m_d->previousPaintInformation.pos();-// // QPointF endPoint = info.pos();-// // qreal distance = QVector2D(endPoint - startPoint).length();--// KisPaintInformation lastUsedPaintInformation;-// //static QPointF lastDrawnPixel = m_d->history.isEmpty() ? m_d->previousPaintInformation.pos() : m_d->history.last().pos();-// QPointF lastDrawnPixel = m_d->previousPaintInformation.pos();-// QPointF waitingPixel = lastDrawnPixel;-// QPointF currentPixel = info.pos();--// //qDebug() << "lastDrawnPixel" << lastDrawnPixel << "waitingPixel" << waitingPixel << "currentPixel" << currentPixel ;-// //qDebug() << "kis_tool_freehand_helper: paint";--// if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::WEIGHTED_SMOOTHING-// && m_d->smoothingOptions->smoothnessDistance() > 0.0) {-// {-// qDebug() << "weighted smoothing in kistool freehand";-// // initialize current distance-// QPointF prevPos;--// if (!m_d->history.isEmpty()) {-// const KisPaintInformation &prevPi = m_d->history.last();-// prevPos = prevPi.pos();-// } else {-// prevPos = m_d->previousPaintInformation.pos();-// }--// qreal currentDistance = QVector2D(info.pos() - prevPos).length();-// m_d->distanceHistory.append(currentDistance);-// }--// m_d->history.append(info);--// qreal x = 0.0;-// qreal y = 0.0;--// if (m_d->history.size() > 3) {-// const qreal sigma = m_d->effectiveSmoothnessDistance() / 3.0; // '3.0' for (3 * sigma) range--// qreal gaussianWeight = 1 / (sqrt(2 * M_PI) * sigma);-// qreal gaussianWeight2 = sigma * sigma;-// qreal distanceSum = 0.0;-// qreal scaleSum = 0.0;-// qreal pressure = 0.0;-// qreal baseRate = 0.0;--// Q_ASSERT(m_d->history.size() == m_d->distanceHistory.size());--// for (int i = m_d->history.size() - 1; i >= 0; i--) {-// qreal rate = 0.0;--// const KisPaintInformation nextInfo = m_d->history.at(i);-// double distance = m_d->distanceHistory.at(i);-// Q_ASSERT(distance >= 0.0);--// qreal pressureGrad = 0.0;-// if (i < m_d->history.size() - 1) {-// pressureGrad = nextInfo.pressure() - m_d->history.at(i + 1).pressure();--// const qreal tailAggressiveness = 40.0 * m_d->smoothingOptions->tailAggressiveness();--// if (pressureGrad > 0.0 ) {-// pressureGrad *= tailAggressiveness * (1.0 - nextInfo.pressure());-// distance += pressureGrad * 3.0 * sigma; // (3 * sigma) --- holds > 90% of the region-// }-// }--// if (gaussianWeight2 != 0.0) {-// distanceSum += distance;-// rate = gaussianWeight * exp(-distanceSum * distanceSum / (2 * gaussianWeight2));-// }--// if (m_d->history.size() - i == 1) {-// baseRate = rate;-// } else if (baseRate / rate > 100) {-// break;-// }--// scaleSum += rate;-// x += rate * nextInfo.pos().x();-// y += rate * nextInfo.pos().y();--// if (m_d->smoothingOptions->smoothPressure()) {-// pressure += rate * nextInfo.pressure();-// }-// }--// if (scaleSum != 0.0) {-// x /= scaleSum;-// y /= scaleSum;--// if (m_d->smoothingOptions->smoothPressure()) {-// pressure /= scaleSum;-// }-// }--// if ((x != 0.0 && y != 0.0) || (x == info.pos().x() && y == info.pos().y())) {-// info.setPos(QPointF(x, y));-// if (m_d->smoothingOptions->smoothPressure()) {-// info.setPressure(pressure);-// }-// m_d->history.last() = info;-// }-// }-// }-- // if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::SIMPLE_SMOOTHING- // || m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::WEIGHTED_SMOOTHING)- // {- // // Now paint between the coordinates, using the bezier curve interpolation- // if (!m_d->haveTangent) {- // qDebug() << "!m_d have tangent " << !m_d->haveTangent;- // m_d->haveTangent = true;- // m_d->previousTangent =- // (info.pos() - m_d->previousPaintInformation.pos()) /- // qMax(qreal(1.0), info.currentTime() - m_d->previousPaintInformation.currentTime());- // } else {- // qDebug() << "else in simple" << !m_d->haveTangent;- // QPointF newTangent = (info.pos() - m_d->olderPaintInformation.pos()) /- // qMax(qreal(1.0), info.currentTime() - m_d->olderPaintInformation.currentTime());-- // if (newTangent.isNull() || m_d->previousTangent.isNull())- // {- // qDebug() << "if (newTangent.isNull() || m_d->previousTangent.isNull()) ";- // paintLine(m_d->previousPaintInformation, info);- // } else {- // qDebug() << "else new tangent";- // QPointF prevPos;-- // if (!m_d->history.isEmpty()) {- // const KisPaintInformation &prevPi = m_d->history.last();- // prevPos = prevPi.pos();- // } else {- // prevPos = m_d->previousPaintInformation.pos();- // }-- // // filtering out < 1 pixel distances- // qreal currentDistance = QVector2D(info.pos() - prevPos).length();- // if (currentDistance < 1) {- // return; // discard this movement- // }-- // // check if the current information is different from the last used information- // if (lastUsedPaintInformation.pos() != info.pos()) {- // paintBezierSegment(m_d->olderPaintInformation, m_d->previousPaintInformation,- // m_d->previousTangent, newTangent);- // lastUsedPaintInformation = info; // update the last used information- // }- // }-- // m_d->previousTangent = newTangent;- // }- // m_d->olderPaintInformation = m_d->previousPaintInformation;- // //qDebug()<< "m_d->olderPaintInformation" << m_d->olderPaintInformation.pos();-- // // Enable stroke timeout only when not airbrushing.- // if (!m_d->airbrushingTimer.isActive()) {- // m_d->strokeTimeoutTimer.start(100);- // }- // }---// else if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::NO_SMOOTHING){-// //qDebug() << "no smoothing in kistool freehand";-// paintLine(m_d->previousPaintInformation, info);-// }--// // if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::PIXEL_PERFECT) {-// // m_d->history.clear();-// // qDebug() << "pixel perfect option detected";-// // }--// if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::STABILIZER) {-// m_d->stabilizedSampler.addEvent(info);-// //qDebug() << "stablizer in kistool freehand";-// if (m_d->stabilizerDelayedPaintHelper.running()) {-// // Paint here so we don't have to rely on the timer-// // This is just a tricky source for a relatively stable 7ms "timer"-// m_d->stabilizerDelayedPaintHelper.paintSome();-// }-// } else {-// //qDebug() << "else";-// m_d->previousPaintInformation = info;-// }--// if(m_d->airbrushingTimer.isActive()) {-// //qDebug() << "airbrush timer";-// m_d->airbrushingTimer.start();-// }-// //qDebug() << "lastDrawnPixel" << lastDrawnPixel << "waitingPixel" << waitingPixel << "currentPixel" << currentPixel ;-// }void KisToolFreehandHelper::paint(KisPaintInformation &info){- //qDebug()<< "kis_tool_freehand_helper::paint";/*** Smooth the coordinates out using the history and the* distance. This is a heavily modified version of an algo used in@@ -699,13 +483,9 @@ void KisToolFreehandHelper::paint(KisPaintInformation &info)QPointF currentPixel = info.pos();- //qDebug() << "lastDrawnPixel" << lastDrawnPixel << "waitingPixel" << waitingPixel << "currentPixel" << currentPixel ;- //qDebug() << "kis_tool_freehand_helper: paint";-if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::WEIGHTED_SMOOTHING&& m_d->smoothingOptions->smoothnessDistance() > 0.0) {{- qDebug() << "weighted smoothing in kistool freehand";// initialize current distanceQPointF prevPos;@@ -794,72 +574,32 @@ void KisToolFreehandHelper::paint(KisPaintInformation &info)}}}--- if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::SIMPLE_SMOOTHING- || m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::WEIGHTED_SMOOTHING){-- // QPointF prevPos;- // if (!m_d->history.isEmpty()) {- // const KisPaintInformation &prevPi = m_d->history.last();- // prevPos = prevPi.pos();- // } else {- // prevPos = m_d->previousPaintInformation.pos();- // }-- // qreal currentDistance = QVector2D(info.pos() - prevPos).length();- // if (currentDistance < 1) {- // return; // discard this movement- // }-- //lets try paintLine before trying paintBezierSegment- //qDebug() << "kis_toolfreehand m_d->history.isEmpty() check: " << m_d->history.isEmpty();- //qDebug() << "paintinfo: " << info.pos();- // initial case: No last drawn pixel or waiting pixel-- if(!m_d->hasLastDrawnPixel){- currentPixel = info.pos();- m_d->waitingPixel = currentPixel;- paintLine(m_d->previousPaintInformation, KisPaintInformation(m_d->waitingPixel));- m_d->lastDrawnPixel = m_d->waitingPixel;- m_d->hasLastDrawnPixel = true;- m_d->pixelInLineCount = 1;- //qDebug() << "no lastDrawnPixel" << m_d->lastDrawnPixel << "waitingPixel" << m_d->waitingPixel << "currentPixel" << currentPixel ;- } else {- // qDebug() << "currentPixel.x(): " << currentPixel.x() << "m_d->lastDrawnPixel.x(): " << m_d->lastDrawnPixel.x() << "currentPixel.y(): " << currentPixel.y() << "m_d->lastDrawnPixel.y(): " << m_d->lastDrawnPixel.y();- if (abs(currentPixel.x() - m_d->lastDrawnPixel.x()) > 1.7 || abs(currentPixel.y() - m_d->lastDrawnPixel.y()) > 1.7) {- // current pixel is too far, draw the waiting pixel- qDebug() << "Pixel is too far!";- qDebug() << "pixelInLineCount 1:" << m_d->pixelInLineCount;- paintLine(m_d->lastDrawnPixel, KisPaintInformation(m_d->waitingPixel));- m_d->pixelInLineCount += 1;- qDebug() << "pixelInLineCount 2:" << m_d->pixelInLineCount;- m_d->lastDrawnPixel = m_d->waitingPixel;- m_d->waitingPixel = currentPixel;- }- // else {- // // !!! try removing this- // // update waiting pixel to current pixel- // //m_d->waitingPixel = currentPixel;- // }-- // check axis, if the currentpixel is in the same axis as the lastdrawnpixel, we can draw- if (m_d->pixelInLineCount > 2 && (currentPixel.x() == m_d->lastDrawnPixel.x() || currentPixel.y() == m_d->lastDrawnPixel.y())) {- qDebug() << "pixelInLineCount 3:" << m_d->pixelInLineCount;- m_d->olderPaintInformation = m_d->previousPaintInformation;- //qDebug()<< "m_d->olderPaintInformation" << m_d->olderPaintInformation.pos();- //qDebug() << "m_d->lastDrawnPixel: " << m_d->lastDrawnPixel << "m_d->waitingPixel: " << m_d->waitingPixel << "currentPixel" << currentPixel;- //draw- m_d->lastDrawnPixel = m_d->waitingPixel;+ if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::SIMPLE_SMOOTHING+ || m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::WEIGHTED_SMOOTHING)+ {+ // Now paint between the coordinates, using the bezier curve interpolation+ if (!m_d->haveTangent) {+ m_d->haveTangent = true;+ m_d->previousTangent =+ (info.pos() - m_d->previousPaintInformation.pos()) /+ qMax(qreal(1.0), info.currentTime() - m_d->previousPaintInformation.currentTime());+ } else {+ QPointF newTangent = (info.pos() - m_d->olderPaintInformation.pos()) /+ qMax(qreal(1.0), info.currentTime() - m_d->olderPaintInformation.currentTime());++ if (newTangent.isNull() || m_d->previousTangent.isNull())+ {+ paintLine(m_d->previousPaintInformation, info);+ } else {+ paintBezierSegment(m_d->olderPaintInformation, m_d->previousPaintInformation,+ m_d->previousTangent, newTangent);}- //otherwise just change update waiting pixel without drawing it- m_d->waitingPixel = currentPixel;-- m_d->pixelInLineCount = 0;- //qDebug() << "lastDrawnPixel" << m_d->lastDrawnPixel << "waitingPixel" << m_d->waitingPixel << "currentPixel" << currentPixel ;+ m_d->previousTangent = newTangent;}+ m_d->olderPaintInformation = m_d->previousPaintInformation;+// Enable stroke timeout only when not airbrushing.if (!m_d->airbrushingTimer.isActive()) {m_d->strokeTimeoutTimer.start(100);@@ -870,26 +610,56 @@ void KisToolFreehandHelper::paint(KisPaintInformation &info)paintLine(m_d->previousPaintInformation, info);}- // if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::PIXEL_PERFECT) {- // m_d->history.clear();- // qDebug() << "pixel perfect option detected";- // }+ 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;+ 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){+ 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;+ }+ // 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;+ }+ 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->pixelInLineCount = 0;+ }+ // Enable stroke timeout only when not airbrushing.+ if (!m_d->airbrushingTimer.isActive()) {+ m_d->strokeTimeoutTimer.start(100);+ }+ }+ }if (m_d->smoothingOptions->smoothingType() == KisSmoothingOptions::STABILIZER) {m_d->stabilizedSampler.addEvent(info);- //qDebug() << "stablizer in kistool freehand";if (m_d->stabilizerDelayedPaintHelper.running()) {// Paint here so we don't have to rely on the timer// This is just a tricky source for a relatively stable 7ms "timer"m_d->stabilizerDelayedPaintHelper.paintSome();}} else {- //qDebug() << "else";m_d->previousPaintInformation = info;}if(m_d->airbrushingTimer.isActive()) {- //qDebug() << "airbrush timer";m_d->airbrushingTimer.start();}}@@ -1050,10 +820,6 @@ void KisToolFreehandHelper::stabilizerPollAndPaint()std::tie(it, end) = m_d->stabilizedSampler.range();QVector<KisPaintInformation> delayedPaintTodoItems;- // for (const KisPaintInformation &info : m_d->stabilizerDeque) {- // qDebug() << info.pos();- // }-for (; it != end; ++it) {KisPaintInformation sampledInfo = *it;diff --git a/libs/ui/tool/kis_tool_freehand_helper.h b/libs/ui/tool/kis_tool_freehand_helper.hindex 645a891e3b..c1d78e9291 100644--- a/libs/ui/tool/kis_tool_freehand_helper.h+++ b/libs/ui/tool/kis_tool_freehand_helper.h@@ -65,7 +65,6 @@ public:KisNodeSP overrideNode = 0,KisDefaultBoundsBaseSP bounds = 0);void paintEvent(KoPointerEvent *event );- //, const std::vector<QPoint>& smoothedPointsvoid endPaint();KisOptimizedBrushOutline paintOpOutline(const QPointF &savedCursorPos,@@ -130,11 +129,9 @@ protected:private:void paint(KisPaintInformation &info );- //, const std::vector<QPoint>& smoothedPointsvoid paintBezierSegment(KisPaintInformation pi1, KisPaintInformation pi2,QPointF tangent1, QPointF tangent2);- //const std::vector<QPoint>& smoothedPointsvoid stabilizerStart(KisPaintInformation firstPaintInfo);void stabilizerEnd();@@ -149,8 +146,6 @@ private Q_SLOTS:void finishStroke();void doAirbrushing();void stabilizerPollAndPaint();- // QVector<KisPaintInformation> filterSubpixelMovements(const QVector<KisPaintInformation> &points);- // void pixelPerfectLinePainter();void slotSmoothingTypeChanged();private:diff --git a/packaging/android/apk/.gradle/7.6.4/checksums/checksums.lock b/packaging/android/apk/.gradle/7.6.4/checksums/checksums.locknew file mode 100644index 0000000000..072f7832efBinary files /dev/null and b/packaging/android/apk/.gradle/7.6.4/checksums/checksums.lock differdiff --git a/packaging/android/apk/.gradle/7.6.4/checksums/md5-checksums.bin b/packaging/android/apk/.gradle/7.6.4/checksums/md5-checksums.binnew file mode 100644index 0000000000..da88982087Binary files /dev/null and b/packaging/android/apk/.gradle/7.6.4/checksums/md5-checksums.bin differdiff --git a/packaging/android/apk/.gradle/7.6.4/checksums/sha1-checksums.bin b/packaging/android/apk/.gradle/7.6.4/checksums/sha1-checksums.binnew file mode 100644index 0000000000..c406f2c7e2Binary files /dev/null and b/packaging/android/apk/.gradle/7.6.4/checksums/sha1-checksums.bin differdiff --git a/packaging/android/apk/.gradle/7.6.4/dependencies-accessors/dependencies-accessors.lock b/packaging/android/apk/.gradle/7.6.4/dependencies-accessors/dependencies-accessors.locknew file mode 100644index 0000000000..c720eb1aa0Binary files /dev/null and b/packaging/android/apk/.gradle/7.6.4/dependencies-accessors/dependencies-accessors.lock differdiff --git a/packaging/android/apk/.gradle/7.6.4/dependencies-accessors/gc.properties b/packaging/android/apk/.gradle/7.6.4/dependencies-accessors/gc.propertiesnew file mode 100644index 0000000000..e69de29bb2diff --git a/packaging/android/apk/.gradle/7.6.4/fileChanges/last-build.bin b/packaging/android/apk/.gradle/7.6.4/fileChanges/last-build.binnew file mode 100644index 0000000000..f76dd238adBinary files /dev/null and b/packaging/android/apk/.gradle/7.6.4/fileChanges/last-build.bin differdiff --git a/packaging/android/apk/.gradle/7.6.4/fileHashes/fileHashes.lock b/packaging/android/apk/.gradle/7.6.4/fileHashes/fileHashes.locknew file mode 100644index 0000000000..3191b5c76eBinary files /dev/null and b/packaging/android/apk/.gradle/7.6.4/fileHashes/fileHashes.lock differdiff --git a/packaging/android/apk/.gradle/7.6.4/gc.properties b/packaging/android/apk/.gradle/7.6.4/gc.propertiesnew file mode 100644index 0000000000..e69de29bb2diff --git a/packaging/android/apk/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/packaging/android/apk/.gradle/buildOutputCleanup/buildOutputCleanup.locknew file mode 100644index 0000000000..cfd2361f4eBinary files /dev/null and b/packaging/android/apk/.gradle/buildOutputCleanup/buildOutputCleanup.lock differdiff --git a/packaging/android/apk/.gradle/buildOutputCleanup/cache.properties b/packaging/android/apk/.gradle/buildOutputCleanup/cache.propertiesnew file mode 100644index 0000000000..0506b400e3--- /dev/null+++ b/packaging/android/apk/.gradle/buildOutputCleanup/cache.properties@@ -0,0 +1,2 @@+#Tue Aug 13 01:32:00 EDT 2024+gradle.version=7.6.4diff --git a/packaging/android/apk/.gradle/vcs-1/gc.properties b/packaging/android/apk/.gradle/vcs-1/gc.propertiesnew file mode 100644index 0000000000..e69de29bb2diff --git a/packaging/android/fdroid/.gradle/8.9/checksums/checksums.lock b/packaging/android/fdroid/.gradle/8.9/checksums/checksums.locknew file mode 100644index 0000000000..dfd7c74530Binary files /dev/null and b/packaging/android/fdroid/.gradle/8.9/checksums/checksums.lock differdiff --git a/packaging/android/fdroid/.gradle/8.9/dependencies-accessors/gc.properties b/packaging/android/fdroid/.gradle/8.9/dependencies-accessors/gc.propertiesnew file mode 100644index 0000000000..e69de29bb2diff --git a/packaging/android/fdroid/.gradle/8.9/executionHistory/executionHistory.lock b/packaging/android/fdroid/.gradle/8.9/executionHistory/executionHistory.locknew file mode 100644index 0000000000..bb99413521Binary files /dev/null and b/packaging/android/fdroid/.gradle/8.9/executionHistory/executionHistory.lock differdiff --git a/packaging/android/fdroid/.gradle/8.9/fileChanges/last-build.bin b/packaging/android/fdroid/.gradle/8.9/fileChanges/last-build.binnew file mode 100644index 0000000000..f76dd238adBinary files /dev/null and b/packaging/android/fdroid/.gradle/8.9/fileChanges/last-build.bin differdiff --git a/packaging/android/fdroid/.gradle/8.9/fileHashes/fileHashes.lock b/packaging/android/fdroid/.gradle/8.9/fileHashes/fileHashes.locknew file mode 100644index 0000000000..54d4a14566Binary files /dev/null and b/packaging/android/fdroid/.gradle/8.9/fileHashes/fileHashes.lock differdiff --git a/packaging/android/fdroid/.gradle/8.9/gc.properties b/packaging/android/fdroid/.gradle/8.9/gc.propertiesnew file mode 100644index 0000000000..e69de29bb2diff --git a/packaging/android/fdroid/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/packaging/android/fdroid/.gradle/buildOutputCleanup/buildOutputCleanup.locknew file mode 100644index 0000000000..11537dbabcBinary files /dev/null and b/packaging/android/fdroid/.gradle/buildOutputCleanup/buildOutputCleanup.lock differdiff --git a/packaging/android/fdroid/.gradle/buildOutputCleanup/cache.properties b/packaging/android/fdroid/.gradle/buildOutputCleanup/cache.propertiesnew file mode 100644index 0000000000..536d8a54b6--- /dev/null+++ b/packaging/android/fdroid/.gradle/buildOutputCleanup/cache.properties@@ -0,0 +1,2 @@+#Tue Aug 13 01:32:38 EDT 2024+gradle.version=8.9diff --git a/packaging/android/fdroid/.gradle/vcs-1/gc.properties b/packaging/android/fdroid/.gradle/vcs-1/gc.propertiesnew file mode 100644index 0000000000..e69de29bb2diff --git a/plugins/paintops/defaultpaintops/brush/kis_brushop.cpp b/plugins/paintops/defaultpaintops/brush/kis_brushop.cppindex e1ed2f422d..49be37cb0f 100644--- a/plugins/paintops/defaultpaintops/brush/kis_brushop.cpp+++ b/plugins/paintops/defaultpaintops/brush/kis_brushop.cpp@@ -34,7 +34,6 @@#include <KisDabCacheUtils.h>#include <KisRenderedDab.h>#include <kis_tool_freehand.h>-// #include "smoothedpointsmanager.h"#include "KisBrushOpResources.h"#include <KisRunnableStrokeJobData.h>@@ -107,7 +106,6 @@ KisSpacingInformation KisBrushOp::paintAt(const KisPaintInformation& info){if (!painter()->device()) return KisSpacingInformation(1.0);- //qDebug()<< "kis_brushop::paintAt";KisBrushSP brush = m_brush;Q_ASSERT(brush);if (!brush)@@ -384,10 +382,9 @@ KisTimingInformation KisBrushOp::updateTimingImpl(const KisPaintInformation &inf{return KisPaintOpPluginUtils::effectiveTiming(&m_airbrushData, &m_rateOption, info);}-//original kisbrushop:paintline+void KisBrushOp::paintLine(const KisPaintInformation& pi1, const KisPaintInformation& pi2, KisDistanceInformation *currentDistance){- //qDebug() << "pi1 " << pi1.pos().toPoint() << "pi2 " << pi2.pos().toPoint();if (m_sharpnessOption.isChecked() && m_brush && (m_brush->width() == 1) && (m_brush->height() == 1)) {if (!m_lineCacheDevice) {@@ -398,9 +395,7 @@ void KisBrushOp::paintLine(const KisPaintInformation& pi1, const KisPaintInforma}KisPainter p(m_lineCacheDevice);- //qDebug()<< "p(m_lineCacheDevice): " << m_lineCacheDevice;p.setPaintColor(painter()->paintColor());- //qDebug() << "pi1.posx: "<< pi1.pos().x()<< "pi1.posy: "<< pi1.pos().y();p.drawDDALine(pi1.pos(), pi2.pos());QRect rc = m_lineCacheDevice->extent();@@ -412,186 +407,3 @@ void KisBrushOp::paintLine(const KisPaintInformation& pi1, const KisPaintInformaKisPaintOp::paintLine(pi1, pi2, currentDistance);}}-// This is a vector approach where we populate/filter out corner pixels in kis_tool_freehand and than call draw line on that (don't know how to get the vector here)-// void KisBrushOp::paintLine(const KisPaintInformation& pi1, const KisPaintInformation& pi2, KisDistanceInformation *currentDistance, const std::vector<QPoint>& smoothedPoints) {--// if (m_sharpnessOption.isChecked() && m_brush && (m_brush->width() == 1) && (m_brush->height() == 1)) {--// if (!m_lineCacheDevice) {-// m_lineCacheDevice = source()->createCompositionSourceDevice();-// }-// else {-// m_lineCacheDevice->clear();-// }--// KisPainter p(m_lineCacheDevice);-// p.setPaintColor(painter()->paintColor());--// // Use smoothedPoints to draw lines-// for (size_t i = 0; i < smoothedPoints.size() - 1; ++i) {-// qDebug() << "smoothedPoints[i], smoothedPoints[i + 1]: " << smoothedPoints[i], smoothedPoints[i + 1];-// p.drawDDALine(smoothedPoints[i], smoothedPoints[i + 1]);-// }--// QRect rc = m_lineCacheDevice->extent();-// painter()->bitBlt(rc.x(), rc.y(), m_lineCacheDevice, rc.x(), rc.y(), rc.width(), rc.height());--// // Fixes Bug 338011-// painter()->renderMirrorMask(rc, m_lineCacheDevice);-// }-// else {-// KisPaintOp::paintLine(pi1, pi2, currentDistance);-// }-// }--// void KisBrushOp::setSmoothedPoints(const std::vector<QPoint>& points) {-// smoothedPoints = points;-// }---// Trying the 3 pixel approach where we track current/lastdrawn/waiting pixel see blog 1 for more info-// basically if currentpixel deviates from the x/y axis of lastdrawn pixel we skip over the intermediary waiting pixel (needs fixes)-// void KisBrushOp::paintLine(const KisPaintInformation& pi1, const KisPaintInformation& pi2, KisDistanceInformation *currentDistance) {-// static bool lastDrawnPixelInitialized = false;-// static QPoint lastDrawnPixel;-// qDebug() << "pi1 " << pi1.pos().toPoint() << "pi2 " << pi2.pos().toPoint();-// if (m_sharpnessOption.isChecked() && m_brush && (m_brush->width() == 1) && (m_brush->height() == 1)) {--// if (!m_lineCacheDevice) {-// m_lineCacheDevice = source()->createCompositionSourceDevice();-// } else {-// m_lineCacheDevice->clear();-// }--// KisPainter p(m_lineCacheDevice);-// p.setPaintColor(painter()->paintColor());--// QPoint currentPixel = pi2.pos().toPoint();-// //this is for the case where last drawn isn't initialized so we draw at least one pixel-// if (!lastDrawnPixelInitialized) {-// // First call, initialize lastDrawnPixel and set the flag--// p.drawDDALine(pi1.pos(), pi2.pos());-// lastDrawnPixel = pi2.pos().toPoint();-// lastDrawnPixelInitialized = true;-// // update lastDrawnPixel to the endpoint of the first drawDDALine call (might not work)-// // lastDrawnPixel = currentPixel;-// } else {--// //-// QPoint waitingPixel = lastDrawnPixel;-// qDebug() << "waitingPixel: " << waitingPixel << "currentPixel: " << currentPixel << "lastDrawnPixel: "<< lastDrawnPixel;-// // Function to draw a line between two points-// auto drawLine = [&](const QPoint& start, const QPoint& end) {-// p.drawDDALine(QPointF(start), QPointF(end));-// };--// // determine the movement direction-// int dx = currentPixel.x() - lastDrawnPixel.x();-// int dy = currentPixel.y() - lastDrawnPixel.y();--// int steps = std::max(abs(dx), abs(dy));-// float xIncrement = dx / static_cast<float>(steps);-// float yIncrement = dy / static_cast<float>(steps);--// float x = lastDrawnPixel.x();-// float y = lastDrawnPixel.y();--// for (int i = 0; i <= steps; ++i) {-// QPoint tempPixel = QPoint(qRound(x), qRound(y));-// // check if tempPixel is in the same direction as lastDrawnPixel-// if ((abs(tempPixel.x() - lastDrawnPixel.x()) <= 1 && tempPixel.y() == lastDrawnPixel.y()) ||-// (abs(tempPixel.y() - lastDrawnPixel.y()) <= 1 && tempPixel.x() == lastDrawnPixel.x())) {-// // continue drawing in the same direction-// waitingPixel = tempPixel;-// drawLine(lastDrawnPixel, waitingPixel);-// lastDrawnPixel = waitingPixel;-// } else {-// // current pixel deviates from x and y, do not draw waiting pixel-// lastDrawnPixel = tempPixel;-// }--// x += xIncrement;-// y += yIncrement;-// }-// }--// QRect rc = m_lineCacheDevice->extent();-// painter()->bitBlt(rc.x(), rc.y(), m_lineCacheDevice, rc.x(), rc.y(), rc.width(), rc.height());-// painter()->renderMirrorMask(rc, m_lineCacheDevice);-// } else {-// KisPaintOp::paintLine(pi1, pi2, currentDistance);-// // Reset the flag when not in pixel-perfect mode-// lastDrawnPixelInitialized = false;-// }-// }--// void KisBrushOp::paintLine(const KisPaintInformation& pi1, const KisPaintInformation& pi2, KisDistanceInformation *currentDistance)-// {-// static QPoint lastDrawnPixel;-// static QPoint currentPixel;-// static QPoint waitingPixel;-// static bool firstPoint = true;-// static bool waitingPixelValid = false;--// auto pixelPerfectAlgorithm = [&](const QPointF& end) {-// currentPixel = end.toPoint();--// if (firstPoint) {-// lastDrawnPixel = currentPixel;-// firstPoint = false;-// return;-// }--// // if the current pixel is adjacent to the last drawn pixel-// if ((qAbs(currentPixel.x() - lastDrawnPixel.x()) <= 1) &&-// (qAbs(currentPixel.y() - lastDrawnPixel.y()) <= 1)) {-// // If the waiting pixel is valid and in the same direction-// if (waitingPixelValid &&-// ((waitingPixel.x() == lastDrawnPixel.x() && waitingPixel.x() == currentPixel.x()) ||-// (waitingPixel.y() == lastDrawnPixel.y() && waitingPixel.y() == currentPixel.y()))) {-// // Draw the waiting pixel-// KisPainter p(m_lineCacheDevice);-// p.setPaintColor(painter()->paintColor());-// p.drawDDALine(lastDrawnPixel, waitingPixel);-// lastDrawnPixel = waitingPixel;-// waitingPixelValid = false;-// }-// waitingPixel = currentPixel;-// waitingPixelValid = true;-// } else {-// // draw the waiting pixel if it is valid-// if (waitingPixelValid) {-// KisPainter p(m_lineCacheDevice);-// p.setPaintColor(painter()->paintColor());-// p.drawDDALine(lastDrawnPixel, waitingPixel);-// lastDrawnPixel = waitingPixel;-// waitingPixelValid = false;-// }-// lastDrawnPixel = currentPixel;-// }-// };--// if (m_sharpnessOption.isChecked() && m_brush && (m_brush->width() == 1) && (m_brush->height() == 1)) {-// if (!m_lineCacheDevice) {-// m_lineCacheDevice = source()->createCompositionSourceDevice();-// } else {-// m_lineCacheDevice->clear();-// }--// KisPainter p(m_lineCacheDevice);-// p.setPaintColor(painter()->paintColor());--// // Apply pixel-perfect algorithm-// pixelPerfectAlgorithm(pi2.pos());--// QRect rc = m_lineCacheDevice->extent();-// painter()->bitBlt(rc.x(), rc.y(), m_lineCacheDevice, rc.x(), rc.y(), rc.width(), rc.height());--// // Fix for Bug 338011-// painter()->renderMirrorMask(rc, m_lineCacheDevice);-// } else {-// KisPaintOp::paintLine(pi1, pi2, currentDistance);-// }-// }-diff --git a/plugins/paintops/defaultpaintops/brush/kis_brushop.h b/plugins/paintops/defaultpaintops/brush/kis_brushop.hindex 4e593928bc..2080016347 100644--- a/plugins/paintops/defaultpaintops/brush/kis_brushop.h+++ b/plugins/paintops/defaultpaintops/brush/kis_brushop.h@@ -21,8 +21,6 @@#include <KisRotationOption.h>#include <KisFlowOpacityOption.h>- #include <kis_tool_freehand.h>-#include <KisRollingMeanAccumulatorWrapper.h>#include <QElapsedTimer>@@ -42,10 +40,8 @@ public:~KisBrushOp() override;void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance) override;- //, const std::vector<QPoint>& smoothedPointsstd::pair<int, bool> doAsynchronousUpdate(QVector<KisRunnableStrokeJobData *> &jobs) override;- // void setSmoothedPoints(const std::vector<QPoint>& points);protected:KisSpacingInformation paintAt(const KisPaintInformation& info) override;@@ -92,7 +88,6 @@ private:const int m_minUpdatePeriod;const int m_maxUpdatePeriod;- // std::vector<QPoint> smoothedPoints;};#endif // KIS_BRUSHOP_H_diff --git a/plugins/paintops/libpaintop/KisSharpnessOption.cpp b/plugins/paintops/libpaintop/KisSharpnessOption.cppindex 581a71482a..5c2cc55367 100644--- a/plugins/paintops/libpaintop/KisSharpnessOption.cpp+++ b/plugins/paintops/libpaintop/KisSharpnessOption.cpp@@ -25,7 +25,6 @@ KisSharpnessOption::KisSharpnessOption(const KisSharpnessOptionData &data): KisCurveOption(data), m_alignOutlinePixels(data.alignOutlinePixels), m_softness(data.softness)- , m_perfectPixel(data.perfectPixel){}@@ -97,8 +96,3 @@ bool KisSharpnessOption::alignOutlineToPixels() const{return m_alignOutlinePixels;}--bool KisSharpnessOption::perfectPixelOption() const-{- return m_perfectPixel;-}\ No newline at end of filediff --git a/plugins/paintops/libpaintop/KisSharpnessOption.h b/plugins/paintops/libpaintop/KisSharpnessOption.hindex 42e8f88543..7f1d3e6e2c 100644--- a/plugins/paintops/libpaintop/KisSharpnessOption.h+++ b/plugins/paintops/libpaintop/KisSharpnessOption.h@@ -24,17 +24,14 @@ public:* Apply threshold specified by user*/void applyThreshold(KisFixedPaintDeviceSP dab, const KisPaintInformation &info);- // void applyPerfectPixel(KisFixedPaintDeviceSP device, const KisPaintInformation &info);bool alignOutlineToPixels() const;- bool perfectPixelOption() const;private:KisSharpnessOption(const KisSharpnessOptionData &data);private:bool m_alignOutlinePixels;int m_softness;- bool m_perfectPixel;};#endif // KISSHARPNESSOPTION_Hdiff --git a/plugins/paintops/libpaintop/KisSharpnessOptionData.cpp b/plugins/paintops/libpaintop/KisSharpnessOptionData.cppindex ace10d2248..87d0beba55 100644--- a/plugins/paintops/libpaintop/KisSharpnessOptionData.cpp+++ b/plugins/paintops/libpaintop/KisSharpnessOptionData.cpp@@ -8,14 +8,12 @@const QString SHARPNESS_FACTOR = "Sharpness/factor";const QString SHARPNESS_ALIGN_OUTLINE_PIXELS = "Sharpness/alignoutline";const QString SHARPNESS_SOFTNESS = "Sharpness/softness";-const QString PERFECT_PIXEL = "Sharpness/perfectpixel";bool KisSharpnessOptionMixInImpl::read(const KisPropertiesConfiguration *setting){alignOutlinePixels = setting->getBool(SHARPNESS_ALIGN_OUTLINE_PIXELS);softness = setting->getInt(SHARPNESS_SOFTNESS);- perfectPixel = setting->getBool(PERFECT_PIXEL);if (setting->hasProperty(SHARPNESS_FACTOR) && !setting->hasProperty("SharpnessValue")) {softness = quint32(setting->getDouble(SHARPNESS_FACTOR) * 100);@@ -28,7 +26,6 @@ void KisSharpnessOptionMixInImpl::write(KisPropertiesConfiguration *setting) con{setting->setProperty(SHARPNESS_ALIGN_OUTLINE_PIXELS, alignOutlinePixels);setting->setProperty(SHARPNESS_SOFTNESS, softness);- setting->setProperty(PERFECT_PIXEL, perfectPixel);}KisSharpnessOptionData::KisSharpnessOptionData(const QString &prefix)diff --git a/plugins/paintops/libpaintop/KisSharpnessOptionData.h b/plugins/paintops/libpaintop/KisSharpnessOptionData.hindex 066fb81535..77d91b68a5 100644--- a/plugins/paintops/libpaintop/KisSharpnessOptionData.h+++ b/plugins/paintops/libpaintop/KisSharpnessOptionData.h@@ -17,13 +17,11 @@ struct PAINTOP_EXPORT KisSharpnessOptionMixInImpl{inline friend bool operator==(const KisSharpnessOptionMixInImpl &lhs, const KisSharpnessOptionMixInImpl &rhs) {return lhs.alignOutlinePixels == rhs.alignOutlinePixels &&- lhs.softness == rhs.softness &&- lhs.perfectPixel == rhs.perfectPixel;+ lhs.softness == rhs.softness;}bool alignOutlinePixels {false};int softness {0};- bool perfectPixel {false};bool read(const KisPropertiesConfiguration *setting);void write(KisPropertiesConfiguration *setting) const;diff --git a/plugins/paintops/libpaintop/KisSharpnessOptionModel.cpp b/plugins/paintops/libpaintop/KisSharpnessOptionModel.cppindex 5621d57e15..a060615a58 100644--- a/plugins/paintops/libpaintop/KisSharpnessOptionModel.cpp+++ b/plugins/paintops/libpaintop/KisSharpnessOptionModel.cpp@@ -9,6 +9,5 @@ KisSharpnessOptionModel::KisSharpnessOptionModel(lager::cursor<KisSharpnessOptio: sharpnessOptionData(optionData), LAGER_QT(alignOutlinePixels) {sharpnessOptionData[&KisSharpnessOptionMixIn::alignOutlinePixels]}, LAGER_QT(softness) {sharpnessOptionData[&KisSharpnessOptionMixIn::softness]}- , LAGER_QT(perfectPixel) {sharpnessOptionData[&KisSharpnessOptionMixIn::perfectPixel]}{}diff --git a/plugins/paintops/libpaintop/KisSharpnessOptionModel.h b/plugins/paintops/libpaintop/KisSharpnessOptionModel.hindex ace930999a..4f53a24a24 100644--- a/plugins/paintops/libpaintop/KisSharpnessOptionModel.h+++ b/plugins/paintops/libpaintop/KisSharpnessOptionModel.h@@ -19,7 +19,6 @@ public:lager::cursor<KisSharpnessOptionMixIn> sharpnessOptionData;LAGER_QT_CURSOR(bool, alignOutlinePixels);LAGER_QT_CURSOR(int, softness);- LAGER_QT_CURSOR(bool, perfectPixel);};#endif // KISSHARPNESSOPTIONMODEL_Hdiff --git a/plugins/paintops/libpaintop/KisSharpnessOptionWidget.cpp b/plugins/paintops/libpaintop/KisSharpnessOptionWidget.cppindex 1547c49729..2ec901956b 100644--- a/plugins/paintops/libpaintop/KisSharpnessOptionWidget.cpp+++ b/plugins/paintops/libpaintop/KisSharpnessOptionWidget.cpp@@ -39,7 +39,6 @@ KisSharpnessOptionWidget::KisSharpnessOptionWidget(lager::cursor<KisSharpnessOptQWidget *page = new QWidget;QCheckBox *alignOutline = new QCheckBox(("Align the brush preview outline to the pixel grid"), page);- QCheckBox *pixelOption = new QCheckBox(("Perfect-Pixel"), page);QLabel* thresholdLbl = new QLabel(i18n("Soften edge:"), page);KisSliderSpinBox *softenEdge = new KisSliderSpinBox(page);@@ -49,7 +48,6 @@ KisSharpnessOptionWidget::KisSharpnessOptionWidget(lager::cursor<KisSharpnessOptQHBoxLayout* alignHL = new QHBoxLayout;alignHL->setContentsMargins(2, 2, 2, 2);alignHL->addWidget(alignOutline);- alignHL->addWidget(pixelOption);QHBoxLayout* softnessHL = new QHBoxLayout;softnessHL->setContentsMargins(9, 9, 9, 9);@@ -65,7 +63,6 @@ KisSharpnessOptionWidget::KisSharpnessOptionWidget(lager::cursor<KisSharpnessOptsetConfigurationPage(page);connectControl(alignOutline, &m_d->model, "alignOutlinePixels");- connectControl(pixelOption, &m_d->model, "perfectPixel");connectControl(softenEdge, &m_d->model, "softness");m_d->model.sharpnessOptionData.bind(std::bind(&KisSharpnessOptionWidget::emitSettingChanged, this));diff --git a/plugins/paintops/libpaintop/kis_current_outline_fetcher.cpp b/plugins/paintops/libpaintop/kis_current_outline_fetcher.cppindex 2071c247c9..f69650c597 100644--- a/plugins/paintops/libpaintop/kis_current_outline_fetcher.cpp+++ b/plugins/paintops/libpaintop/kis_current_outline_fetcher.cpp@@ -137,7 +137,6 @@ KisOptimizedBrushOutline KisCurrentOutlineFetcher::fetchOutline(const KisPaintInQPointF pos = info.pos();if (d->sharpnessOption && d->sharpnessOption->alignOutlineToPixels()) {- // qDebug() << "perfectPixelOption in kis_current_outline_fetcher" << d->sharpnessOption->perfectPixelOption() ;qint32 x = 0;qint32 y = 0;qreal subPixelX = 0.0;diff --git a/plugins/tools/basictools/kis_tool_brush.cc b/plugins/tools/basictools/kis_tool_brush.ccindex 7959a32e46..9985d21f7a 100644--- a/plugins/tools/basictools/kis_tool_brush.cc+++ b/plugins/tools/basictools/kis_tool_brush.cc@@ -63,6 +63,7 @@ KisToolBrush::KisToolBrush(KoCanvasBase * canvas)addSmoothingAction(KisSmoothingOptions::NO_SMOOTHING, "set_no_brush_smoothing");addSmoothingAction(KisSmoothingOptions::SIMPLE_SMOOTHING, "set_simple_brush_smoothing");addSmoothingAction(KisSmoothingOptions::WEIGHTED_SMOOTHING, "set_weighted_brush_smoothing");+ addSmoothingAction(KisSmoothingOptions::PIXEL_PERFECT, "set_simple_brush_smoothing");addSmoothingAction(KisSmoothingOptions::STABILIZER, "set_stabilizer_brush_smoothing");}@@ -152,6 +153,16 @@ void KisToolBrush::slotSetSmoothingType(int index)showControl(m_chkStabilizeSensors, false);break;case 3:+ smoothingOptions()->setSmoothingType(KisSmoothingOptions::PIXEL_PERFECT);+ showControl(m_sliderSmoothnessDistance, false);+ showControl(m_sliderTailAggressiveness, false);+ showControl(m_chkSmoothPressure, false);+ showControl(m_chkUseScalableDistance, false);+ showControl(m_sliderDelayDistance, false);+ showControl(m_chkFinishStabilizedCurve, false);+ showControl(m_chkStabilizeSensors, false);+ break;+ case 4:default:smoothingOptions()->setSmoothingType(KisSmoothingOptions::STABILIZER);showControl(m_sliderSmoothnessDistance, true);@@ -345,8 +356,8 @@ QWidget * KisToolBrush::createOptionWidget()<< i18nc("@item:inlistbox Brush Smoothing", "None")<< i18nc("@item:inlistbox Brush Smoothing", "Basic")<< i18nc("@item:inlistbox Brush Smoothing", "Weighted")- << i18nc("@item:inlistbox Brush Smoothing", "Stabilizer")- << i18nc("@item:inlistbox Brush Smoothing", "Pixel"));+ << i18nc("@item:inlistbox Brush Smoothing", "Pixel (Beta)")+ << i18nc("@item:inlistbox Brush Smoothing", "Stabilizer"));connect(m_cmbSmoothingType, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetSmoothingType(int)));addOptionWidgetOption(m_cmbSmoothingType, new QLabel(i18n("Brush Smoothing:"), optionsWidget));