Skip to content

Commit

Permalink
functionality of QskBoxFillNode/QskRectangleNode moved into QskBoxRec…
Browse files Browse the repository at this point in the history
…tangleNode
  • Loading branch information
uwerat committed Sep 17, 2024
1 parent 58344c0 commit 6c391b8
Show file tree
Hide file tree
Showing 13 changed files with 192 additions and 411 deletions.
2 changes: 1 addition & 1 deletion examples/frames/Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void Frame::updateFrameNode( const QRectF& rect, QskBoxRectangleNode* node )
const QskBoxBorderColors borderColors( c1, c1, c2, c2 );
const qreal radius = effectiveRadius( rect, m_radius );

node->updateNode( rect, radius, m_frameWidth, borderColors, m_color );
node->updateBox( rect, radius, m_frameWidth, borderColors, m_color );
}

#include "moc_Frame.cpp"
2 changes: 1 addition & 1 deletion examples/iotdashboard/DiagramSkinlet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ QSGNode* DiagramSkinlet::updateChartNode( const Diagram* diagram, QSGNode* node
color = diagram->color( barSubcontrol );

const auto shape = diagram->boxShapeHint( barSubcontrol );
barNode->updateNode( barRect, shape, {}, {}, color );
barNode->updateFilling( barRect, shape, color );
}
}
else
Expand Down
9 changes: 5 additions & 4 deletions playground/gradients/GradientView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#endif

#include <QskPaintedNode.h>
#include <QskBoxFillNode.h>
#include <QskBoxRectangleNode.h>
#include <QskGradient.h>
#include <QskGradientDirection.h>
Expand Down Expand Up @@ -165,15 +164,17 @@ QSGNode* GradientView::updatePaintNode(
}
case BoxFill:
{
auto node = gradientNode< QskBoxFillNode >( oldNode );
node->updateNode( rect, m_gradient );
auto node = gradientNode< QskBoxRectangleNode >( oldNode );
node->setHint( QskFillNode::PreferColoredGeometry, false );
node->updateFilling( rect, shape, m_gradient );

return node;
}
case BoxRectangle:
{
auto node = gradientNode< QskBoxRectangleNode >( oldNode );
node->updateNode( rect, shape, m_gradient );
node->setHint( QskFillNode::PreferColoredGeometry, true );
node->updateFilling( rect, shape, m_gradient );

return node;
}
Expand Down
3 changes: 0 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ list(APPEND HEADERS
nodes/QskBasicLinesNode.h
nodes/QskBoxNode.h
nodes/QskBoxClipNode.h
nodes/QskBoxFillNode.h
nodes/QskBoxRectangleNode.h
nodes/QskBoxRenderer.h
nodes/QskBoxMetrics.h
Expand Down Expand Up @@ -149,7 +148,6 @@ list(APPEND SOURCES
nodes/QskBasicLinesNode.cpp
nodes/QskBoxNode.cpp
nodes/QskBoxClipNode.cpp
nodes/QskBoxFillNode.cpp
nodes/QskBoxRectangleNode.cpp
nodes/QskBoxRenderer.cpp
nodes/QskBoxMetrics.cpp
Expand All @@ -164,7 +162,6 @@ list(APPEND SOURCES
nodes/QskLinesNode.cpp
nodes/QskPaintedNode.cpp
nodes/QskPlainTextRenderer.cpp
nodes/QskRectangleNode.cpp
nodes/QskRichTextRenderer.cpp
nodes/QskSceneTexture.cpp
nodes/QskSGNode.cpp
Expand Down
6 changes: 3 additions & 3 deletions src/controls/QskSkinlet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "QskGraphicNode.h"
#include "QskGraphic.h"
#include "QskLinesNode.h"
#include "QskRectangleNode.h"
#include "QskSGNode.h"
#include "QskStippleMetrics.h"
#include "QskTextColors.h"
Expand Down Expand Up @@ -373,8 +372,9 @@ QSGNode* QskSkinlet::updateBackgroundNode(
if ( !gradient.isValid() )
return nullptr;

auto rectNode = QskSGNode::ensureNode< QskRectangleNode >( node );
rectNode->updateNode( rect, gradient );
auto rectNode = QskSGNode::ensureNode< QskBoxRectangleNode >( node );
rectNode->updateFilling( rect, QskBoxShapeMetrics(),
QskBoxBorderMetrics(), gradient );

return rectNode;
}
Expand Down
95 changes: 0 additions & 95 deletions src/nodes/QskBoxFillNode.cpp

This file was deleted.

35 changes: 0 additions & 35 deletions src/nodes/QskBoxFillNode.h

This file was deleted.

20 changes: 6 additions & 14 deletions src/nodes/QskBoxNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
*****************************************************************************/

#include "QskBoxNode.h"
#include "QskBoxFillNode.h"
#include "QskBoxShadowNode.h"
#include "QskBoxRectangleNode.h"
#include "QskBoxRenderer.h"
#include "QskSGNode.h"

#include "QskGradient.h"
Expand Down Expand Up @@ -67,7 +65,7 @@ void QskBoxNode::updateNode( const QRectF& rect,

QskBoxShadowNode* shadowNode = nullptr;
QskBoxRectangleNode* rectNode = nullptr;
QskBoxFillNode* fillNode = nullptr;
QskBoxRectangleNode* fillNode = nullptr;

if ( !shadowMetrics.isNull()
&& shadowColor.isValid() && shadowColor.alpha() != 0 )
Expand All @@ -77,29 +75,23 @@ void QskBoxNode::updateNode( const QRectF& rect,
shape, shadowMetrics.blurRadius(), shadowColor );
}

/*
QskBoxRectangleNode is more efficient and creates batchable geometries.
So we prefer using it where possible.
Note, that the border is always done with a QskBoxRectangleNode
*/

if ( QskBoxRenderer::isGradientSupported( gradient ) )
if ( QskBoxRectangleNode::isCombinedGeometrySupported( gradient ) )
{
rectNode = qskNode< QskBoxRectangleNode >( this, BoxRole );
rectNode->updateNode( rect, shape, borderMetrics, borderColors, gradient );
rectNode->updateBox( rect, shape, borderMetrics, borderColors, gradient );
}
else
{
if ( !borderMetrics.isNull() && borderColors.isVisible() )
{
rectNode = qskNode< QskBoxRectangleNode >( this, BoxRole );
rectNode->updateNode( rect, shape, borderMetrics, borderColors, QskGradient() );
rectNode->updateBorder( rect, shape, borderMetrics, borderColors );
}

if ( gradient.isVisible() )
{
fillNode = qskNode< QskBoxFillNode >( this, FillRole );
fillNode->updateNode( rect, shape, borderMetrics, gradient );
fillNode = qskNode< QskBoxRectangleNode >( this, FillRole );
fillNode->updateFilling( rect, shape, borderMetrics, gradient );
}
}

Expand Down
Loading

0 comments on commit 6c391b8

Please sign in to comment.