QskShapeNode::updateNode -> updatePath. workaround for a bug that has

not yet been understood reintroduced
This commit is contained in:
Uwe Rathmann 2024-09-26 17:07:54 +02:00
parent f898746019
commit 6a2e07339e
3 changed files with 17 additions and 6 deletions

View File

@ -185,7 +185,7 @@ void ShapeItem::updateNode( QSGNode* parentNode )
#endif
const auto transform = ::transformForRects( pathRect, fillRect );
fillNode->updateNode( m_data->path, transform, fillRect, m_data->gradient );
fillNode->updatePath( m_data->path, transform, fillRect, m_data->gradient );
}
else
{

View File

@ -18,7 +18,7 @@ QSK_QT_PRIVATE_END
// keeping the index list
static void qskUpdateGeometry( const QPainterPath& path,
const QTransform& transform, QSGGeometry& geometry )
const QTransform& transform, const QColor&, QSGGeometry& geometry )
{
const auto ts = qTriangulate( path, transform, 1, false );
@ -27,14 +27,14 @@ static void qskUpdateGeometry( const QPainterPath& path,
auto vertexData = reinterpret_cast< float* >( geometry.vertexData() );
const auto points = ts.vertices.constData();
for ( int i = 0; i < ts.vertices.size(); i++ )
for ( int i = 0; i < ts.vertices.count(); i++ )
vertexData[i] = points[i];
memcpy( geometry.indexData(), ts.indices.data(),
ts.indices.size() * sizeof( quint16 ) );
}
#endif
#else
static void qskUpdateGeometry( const QPainterPath& path,
const QTransform& transform, const QColor& color, QSGGeometry& geometry )
@ -83,6 +83,8 @@ static void qskUpdateGeometry( const QPainterPath& path,
}
}
#endif
class QskShapeNodePrivate final : public QskFillNodePrivate
{
public:
@ -97,6 +99,15 @@ class QskShapeNodePrivate final : public QskFillNodePrivate
QskShapeNode::QskShapeNode()
: QskFillNode( *new QskShapeNodePrivate )
{
#if 1
/*
for some reason we have a broken geometry for some of
contours of shapes example, when not setting Monochrome.
Does not make any sense and needs to be understood: TODO
*/
setColoring( Monochrome );
#endif
geometry()->setDrawingMode( QSGGeometry::DrawTriangles );
}
@ -104,7 +115,7 @@ QskShapeNode::~QskShapeNode()
{
}
void QskShapeNode::updateNode( const QPainterPath& path,
void QskShapeNode::updatePath( const QPainterPath& path,
const QTransform& transform, const QRectF& rect, const QskGradient& gradient )
{
Q_D( QskShapeNode );

View File

@ -23,7 +23,7 @@ class QSK_EXPORT QskShapeNode : public QskFillNode
QskShapeNode();
~QskShapeNode() override;
void updateNode( const QPainterPath&, const QTransform&,
void updatePath( const QPainterPath&, const QTransform&,
const QRectF&, const QskGradient& );
private: