using QSGGeometry::updateTexturedRectGeometry

This commit is contained in:
Uwe Rathmann 2023-12-13 15:09:20 +01:00
parent 245491724d
commit dda2525970
1 changed files with 7 additions and 29 deletions

View File

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