diff --git a/src/nodes/QskShapeNode.cpp b/src/nodes/QskShapeNode.cpp index fc6b5f9a..af973f1a 100644 --- a/src/nodes/QskShapeNode.cpp +++ b/src/nodes/QskShapeNode.cpp @@ -13,12 +13,14 @@ QSK_QT_PRIVATE_BEGIN #include QSK_QT_PRIVATE_END +#if 0 + +// keeping the index list static void qskUpdateGeometry( const QPainterPath& path, const QTransform& transform, QSGGeometry& geometry ) { const auto ts = qTriangulate( path, transform, 1, false ); -#if 1 geometry.allocate( ts.vertices.size(), ts.indices.size() ); auto vertexData = reinterpret_cast< float* >( geometry.vertexData() ); @@ -29,11 +31,22 @@ static void qskUpdateGeometry( const QPainterPath& path, memcpy( geometry.indexData(), ts.indices.data(), ts.indices.size() * sizeof( quint16 ) ); -#else +} + +#endif + +static void qskUpdateGeometry( const QPainterPath& path, + const QTransform& transform, QSGGeometry& geometry ) +{ + const auto ts = qTriangulate( path, transform, 1, false ); + /* + The triangulation of a random path does not lead to index lists + that are substantially reducing the number of vertices. + As we have to iterate over the vertex buffer to copy qreal to float - anyway we could reorder according to the index buffer and drop - the index buffer then ??? + anyway we reorder according to the index buffer and drop + the index buffer. QTriangleSet: @@ -41,6 +54,7 @@ static void qskUpdateGeometry( const QPainterPath& path, QVector vertices; // [x[0], y[0], x[1], y[1], x[2], ...] QVector indices; // [i[0], j[0], k[0], i[1], j[1], k[1], i[2], ...] */ + const auto points = ts.vertices.constData(); const auto indices = reinterpret_cast< const quint16* >( ts.indices.data() ); @@ -52,7 +66,6 @@ static void qskUpdateGeometry( const QPainterPath& path, const int j = 2 * indices[i]; vertexData[i].set( points[j], points[j + 1] ); } -#endif } class QskShapeNodePrivate final : public QskFillNodePrivate