From dda252597072fc6f999c3c88bf9ca3f0f51a5ba2 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 13 Dec 2023 15:09:20 +0100 Subject: [PATCH] using QSGGeometry::updateTexturedRectGeometry --- playground/parrots/BlurringNode.cpp | 36 ++++++----------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/playground/parrots/BlurringNode.cpp b/playground/parrots/BlurringNode.cpp index 0e8214a7..66fdbf5a 100644 --- a/playground/parrots/BlurringNode.cpp +++ b/playground/parrots/BlurringNode.cpp @@ -159,38 +159,16 @@ void BlurringNode::setRect( const QRectF& rect ) { Q_D( BlurringNode ); - if ( rect == d->rect ) - return; - - d->rect = rect; - - struct Point : QSGGeometry::Point2D + if ( rect != d->rect ) { - inline void operator=( const QPointF& pos ) - { - x = static_cast< float >( pos.x() ); - y = static_cast< float >( pos.y() ); - } - }; + d->rect = rect; - const QRectF r0( 0, 0, 1, 1 ); + QSGGeometry::updateTexturedRectGeometry( + &d->geometry, rect, QRectF( 0, 0, 1, 1 ) ); - auto points = static_cast< Point* >( d->geometry.vertexData() ); - - points[0] = rect.topLeft(); - points[1] = r0.topLeft(); - - points[2] = rect.topRight(); - points[3] = r0.topRight(); - - points[4] = rect.bottomLeft(); - points[5] = r0.bottomLeft(); - - points[6] = rect.bottomRight(); - points[7] = r0.bottomRight(); - - d->geometry.markVertexDataDirty(); - markDirty( QSGNode::DirtyGeometry ); + d->geometry.markVertexDataDirty(); + markDirty( QSGNode::DirtyGeometry ); + } } QRectF BlurringNode::rect() const