2022-09-01 13:56:20 +00:00
|
|
|
#include "BlurredBoxSkinlet.h"
|
|
|
|
#include "BlurredBox.h"
|
|
|
|
#include "BlurredBoxNode.h"
|
|
|
|
|
|
|
|
BlurredBoxSkinlet::BlurredBoxSkinlet()
|
|
|
|
{
|
|
|
|
setNodeRoles( { PanelRole } );
|
|
|
|
}
|
|
|
|
|
|
|
|
QRectF BlurredBoxSkinlet::subControlRect(
|
|
|
|
const QskSkinnable*, const QRectF& contentsRect, QskAspect::Subcontrol ) const
|
|
|
|
{
|
|
|
|
return contentsRect;
|
|
|
|
}
|
|
|
|
|
|
|
|
QSGNode* BlurredBoxSkinlet::updateSubNode(
|
|
|
|
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
|
|
|
{
|
|
|
|
const auto box = dynamic_cast< const BlurredBox* >( skinnable );
|
|
|
|
const auto r = box->subControlRect( BlurredBox::Panel );
|
|
|
|
|
|
|
|
if ( r.isEmpty() )
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto result = QskSkinlet::updateSubNode( skinnable, nodeRole, node );
|
|
|
|
|
|
|
|
switch ( nodeRole )
|
|
|
|
{
|
|
|
|
case PanelRole:
|
2022-09-07 14:13:59 +00:00
|
|
|
auto* const blurred = QskSGNode::ensureNode< BlurredBoxNode >( node );
|
|
|
|
const auto rectOfScreen = box->rectOfScreen();
|
|
|
|
const auto rectOnScreen = box->rectOnScreen();
|
|
|
|
const auto boxShapeHint = box->boxShapeHint(BlurredBox::Panel);
|
|
|
|
blurred->setBlurData( r, boxShapeHint, rectOfScreen, rectOnScreen,
|
2022-09-01 13:56:20 +00:00
|
|
|
static_cast< float >( box->opacity() ), box->blurDirections(), box->blurQuality(),
|
|
|
|
box->blurSize() );
|
|
|
|
return blurred;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|