code improved
This commit is contained in:
parent
b1e37876a6
commit
b004e6d8d5
|
@ -77,16 +77,16 @@ static inline QSGNode* qskUpdateGraphicNode(
|
||||||
if ( rect.isEmpty() )
|
if ( rect.isEmpty() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
const auto control = skinnable->owningControl();
|
||||||
|
if ( control == nullptr )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
auto mode = QskTextureRenderer::OpenGL;
|
auto mode = QskTextureRenderer::OpenGL;
|
||||||
|
|
||||||
auto graphicNode = static_cast< QskGraphicNode* >( node );
|
auto graphicNode = static_cast< QskGraphicNode* >( node );
|
||||||
if ( graphicNode == nullptr )
|
if ( graphicNode == nullptr )
|
||||||
graphicNode = new QskGraphicNode();
|
graphicNode = new QskGraphicNode();
|
||||||
|
|
||||||
QRectF r = rect;
|
|
||||||
|
|
||||||
if ( const auto control = skinnable->owningControl() )
|
|
||||||
{
|
|
||||||
if ( control->testControlFlag( QskControl::PreferRasterForTextures ) )
|
if ( control->testControlFlag( QskControl::PreferRasterForTextures ) )
|
||||||
mode = QskTextureRenderer::Raster;
|
mode = QskTextureRenderer::Raster;
|
||||||
|
|
||||||
|
@ -96,13 +96,12 @@ static inline QSGNode* qskUpdateGraphicNode(
|
||||||
will be floored/ceiled ending up with a slightly different
|
will be floored/ceiled ending up with a slightly different
|
||||||
aspect ratio.
|
aspect ratio.
|
||||||
*/
|
*/
|
||||||
const QRectF sceneRect(
|
QRectF r(
|
||||||
control->mapToScene( r.topLeft() ),
|
control->mapToScene( rect.topLeft() ),
|
||||||
r.size() * QskTextureRenderer::devicePixelRatio() );
|
rect.size() * QskTextureRenderer::devicePixelRatio() );
|
||||||
|
|
||||||
r = qskInnerRect( sceneRect );
|
r = qskInnerRect( r );
|
||||||
r.moveTopLeft( control->mapFromScene( r.topLeft() ) );
|
r.moveTopLeft( control->mapFromScene( r.topLeft() ) );
|
||||||
}
|
|
||||||
|
|
||||||
graphicNode->setGraphic( graphic, colorFilter, mode, r );
|
graphicNode->setGraphic( graphic, colorFilter, mode, r );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue