6#include "QskBoxClipNode.h"
7#include "QskBoxBorderMetrics.h"
8#include "QskBoxRenderer.h"
9#include "QskBoxShapeMetrics.h"
10#include "QskFunctions.h"
12#include <qquickitem.h>
14static inline QskHashValue qskMetricsHash(
17 QskHashValue hash = 13000;
19 hash = shape.hash( hash );
20 return border.hash( hash );
23QskBoxClipNode::QskBoxClipNode()
25 , m_geometry( QSGGeometry::defaultAttributes_Point2D(), 0 )
27 setGeometry( &m_geometry );
30QskBoxClipNode::~QskBoxClipNode()
34void QskBoxClipNode::setBox(
const QQuickWindow* window,
const QRectF& rect,
37 const auto hash = qskMetricsHash( shape, border );
38 if ( hash == m_hash && rect == m_rect )
44 bool isRectangular =
false;
58 if ( shape.isRectangle() )
64 if ( m_geometry.vertexCount() > 0 )
65 m_geometry.allocate( 0 );
67 setIsRectangular(
true );
71 setIsRectangular(
false );
74 renderer.setFillLines( rect, shape, border, m_geometry );
81 setClipRect( qskValidOrEmptyInnerRect( rect, border.widths() ) );
83 m_geometry.markVertexDataDirty();
84 markDirty( QSGNode::DirtyGeometry );