Add debug streaming operator to TriangleData
Also ifndef QT_NO_DEBUG_STREAM around the QQuadPath debug op. Both will be omitted from the build if QT_NO_DEBUG_STREAM is set. Change-Id: Ie86577ba61fc4f2b118d7e0a2b1ab702b318a473 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
a79ac8cbb4
commit
24838eb716
|
@ -326,8 +326,32 @@ struct TriangleData
|
|||
TrianglePoints points;
|
||||
int pathElementIndex = std::numeric_limits<int>::min();
|
||||
TrianglePoints normals;
|
||||
|
||||
private:
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
friend QDebug operator<<(QDebug, const TriangleData &);
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug stream, const TriangleData &td)
|
||||
{
|
||||
QDebugStateSaver saver(stream);
|
||||
stream.nospace();
|
||||
stream << "TriangleData(";
|
||||
if (td.pathElementIndex != std::numeric_limits<int>::min())
|
||||
stream << "idx " << td.pathElementIndex;
|
||||
stream << " [" << td.points.at(0).x() << ", " << td.points.at(0).y()
|
||||
<< "; " << td.points.at(1).x() << ", " << td.points.at(1).y()
|
||||
<< "; " << td.points.at(2).x() << ", " << td.points.at(2).y()
|
||||
<< "] normals [" << td.normals.at(0).x() << ", " << td.points.at(0).y()
|
||||
<< "; " << td.normals.at(1).x() << ", " << td.normals.at(1).y()
|
||||
<< "; " << td.normals.at(2).x() << ", " << td.normals.at(2).y()
|
||||
<< "])";
|
||||
return stream;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Returns a normalized vector that is perpendicular to baseLine, pointing to the right
|
||||
inline QVector2D normalVector(QVector2D baseLine)
|
||||
{
|
||||
|
@ -1549,6 +1573,7 @@ void QSGCurveProcessor::processStroke(const QQuadPath &strokePath,
|
|||
{
|
||||
auto thePath = subdivide(strokePath, subdivisions).flattened(); // TODO: don't flatten, but handle it in the triangulator
|
||||
auto triangles = customTriangulator2(thePath, penWidth, joinStyle, capStyle, miterLimit);
|
||||
qCDebug(lcSGCurveProcessor) << thePath << "->" << triangles;
|
||||
|
||||
auto addCurveTriangle = [&](const QQuadPath::Element &element, const TriangleData &t) {
|
||||
QSGCurveStrokeNode::TriangleFlags flags;
|
||||
|
|
|
@ -957,6 +957,7 @@ static void printElement(QDebug stream, const QQuadPath::Element &element)
|
|||
<< (element.isSubpathStart() ? "S" : element.isSubpathEnd() ? "E" : "");
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
QDebug operator<<(QDebug stream, const QQuadPath::Element &element)
|
||||
{
|
||||
QDebugStateSaver saver(stream);
|
||||
|
@ -984,5 +985,6 @@ QDebug operator<<(QDebug stream, const QQuadPath &path)
|
|||
stream << ")";
|
||||
return stream;
|
||||
}
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
@ -182,7 +182,9 @@ public:
|
|||
quint8 m_isSubpathEnd : 1;
|
||||
quint8 m_isLine : 1;
|
||||
friend class QQuadPath;
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
friend Q_QUICK_EXPORT QDebug operator<<(QDebug, const QQuadPath::Element &);
|
||||
#endif
|
||||
};
|
||||
|
||||
void moveTo(const QVector2D &to)
|
||||
|
@ -319,7 +321,9 @@ private:
|
|||
void addElement(const Element &e);
|
||||
Element::FillSide coordinateOrderOfElement(const Element &element) const;
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
friend Q_QUICK_EXPORT QDebug operator<<(QDebug, const QQuadPath &);
|
||||
#endif
|
||||
|
||||
QList<Element> m_elements;
|
||||
QList<Element> m_childElements;
|
||||
|
@ -333,8 +337,10 @@ private:
|
|||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QQuadPath::PathHints);
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
Q_QUICK_EXPORT QDebug operator<<(QDebug, const QQuadPath::Element &);
|
||||
Q_QUICK_EXPORT QDebug operator<<(QDebug, const QQuadPath &);
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
|
Loading…
Reference in New Issue