code improved

This commit is contained in:
Uwe Rathmann 2020-10-31 08:06:41 +01:00
parent b1e37876a6
commit b004e6d8d5
1 changed files with 17 additions and 18 deletions

View File

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