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++

Add debug for VectorPath and VectorPathPoint

Agata Cackoee43ffe9b3fb
diff --git a/libs/global/kis_algebra_2d.cpp b/libs/global/kis_algebra_2d.cpp
index 2132e81030..34550b53aa 100644
--- a/libs/global/kis_algebra_2d.cpp
+++ b/libs/global/kis_algebra_2d.cpp
@@ -2321,6 +2321,32 @@ QPainterPath VectorPath::asPainterPath() const
return response;
}
+QDebug operator<<(QDebug debug, const VectorPath &path)
+{
+ debug << path.asPainterPath();
+ return debug;
+}
+
+
+
+
+QDebug operator<<(QDebug debug, const VectorPath::VectorPathPoint &point)
+{
+ bool autoInsertSpaces = debug.autoInsertSpaces();
+ debug.setAutoInsertSpaces(false);
+ debug << (point.type == VectorPath::VectorPathPoint::MoveTo ? "(move " : (point.type == VectorPath::VectorPathPoint::BezierTo ? "(curve " : "(line "));
+ debug << "(" << point.endPoint.x() << ", " << point.endPoint.y() << ")";
+ if (point.type == VectorPath::VectorPathPoint::BezierTo) {
+ debug << ": (";
+ debug << "(" << point.controlPoint1.x() << ", " << point.controlPoint1.y() << ")";
+ debug << ", ";
+ debug << "(" << point.controlPoint2.x() << ", " << point.controlPoint2.y() << ")";
+ debug << ")";
+ }
+ debug << ")";
+ debug.setAutoInsertSpaces(autoInsertSpaces);
+ return debug;
+}
} // namespace
diff --git a/libs/global/kis_algebra_2d.h b/libs/global/kis_algebra_2d.h
index 3a076390dd..9803d1529f 100644
--- a/libs/global/kis_algebra_2d.h
+++ b/libs/global/kis_algebra_2d.h
@@ -686,6 +686,10 @@ private:
};
+QDebug operator<<(QDebug debug, const VectorPath &path);
+QDebug operator<<(QDebug debug, const VectorPath::VectorPathPoint &point);
+
+
QVector<QPoint> KRITAGLOBAL_EXPORT sampleRectWithPoints(const QRect &rect);
QVector<QPointF> KRITAGLOBAL_EXPORT sampleRectWithPoints(const QRectF &rect);