QskSGNode::resetGeometry added
This commit is contained in:
parent
740101b9a2
commit
6ed417873e
@ -10,6 +10,7 @@
|
||||
#include "QskBoxShapeMetrics.h"
|
||||
#include "QskBoxBorderMetrics.h"
|
||||
#include "QskBoxRenderer.h"
|
||||
#include "QskSGNode.h"
|
||||
|
||||
#include <qsgflatcolormaterial.h>
|
||||
|
||||
@ -41,16 +42,6 @@ static inline QskGradient qskEffectiveGradient( const QskGradient& gradient )
|
||||
return gradient;
|
||||
}
|
||||
|
||||
static inline void qskResetGeometry( QskBoxFillNode* node )
|
||||
{
|
||||
auto g = node->geometry();
|
||||
if ( g->vertexCount() > 0 )
|
||||
{
|
||||
g->allocate( 0 );
|
||||
node->markDirty( QSGNode::DirtyGeometry );
|
||||
}
|
||||
}
|
||||
|
||||
class QskBoxFillNodePrivate final : public QSGGeometryNodePrivate
|
||||
{
|
||||
public:
|
||||
@ -86,7 +77,7 @@ void QskBoxFillNode::updateNode(
|
||||
{
|
||||
d->rect = QRectF();
|
||||
d->metricsHash = 0;
|
||||
qskResetGeometry( this );
|
||||
QskSGNode::resetGeometry( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -166,3 +166,18 @@ void QskSGNode::replaceChildNode(
|
||||
delete oldNode;
|
||||
}
|
||||
}
|
||||
|
||||
void QskSGNode::resetGeometry( QSGGeometryNode* node )
|
||||
{
|
||||
if ( node )
|
||||
{
|
||||
if ( auto g = node->geometry() )
|
||||
{
|
||||
if ( g->vertexCount() > 0 || g->indexCount() > 0 )
|
||||
{
|
||||
g->allocate( 0, 0 );
|
||||
node->markDirty( QSGNode::DirtyGeometry );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,8 @@ namespace QskSGNode
|
||||
|
||||
return static_cast< Node* >( node );
|
||||
}
|
||||
|
||||
void resetGeometry( QSGGeometryNode* );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "QskGradientMaterial.h"
|
||||
#include "QskGradient.h"
|
||||
#include "QskGradientDirection.h"
|
||||
#include "QskSGNode.h"
|
||||
|
||||
#include <qsgflatcolormaterial.h>
|
||||
|
||||
@ -73,16 +74,6 @@ static void qskUpdateGeometry( const QPainterPath& path,
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void qskResetGeometry( QskShapeNode* node )
|
||||
{
|
||||
auto g = node->geometry();
|
||||
if ( g->vertexCount() > 0 )
|
||||
{
|
||||
g->allocate( 0 );
|
||||
node->markDirty( QSGNode::DirtyGeometry );
|
||||
}
|
||||
}
|
||||
|
||||
class QskShapeNodePrivate final : public QSGGeometryNodePrivate
|
||||
{
|
||||
public:
|
||||
@ -122,7 +113,7 @@ void QskShapeNode::updateNode( const QPainterPath& path,
|
||||
{
|
||||
d->path = QPainterPath();
|
||||
d->transform = QTransform();
|
||||
qskResetGeometry( this );
|
||||
QskSGNode::resetGeometry( this );
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user