diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-11-17 20:09:28 +0100 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-11-20 15:47:21 +0100 |
commit | 7fbc14053cb3db4b0cfe31d00da158720d7c24ee (patch) | |
tree | 54586cf7af693f7efc8cbf903abcb416a58472cb /src | |
parent | e33dba8f0a164c18e75a81d5376df2eeb2181ccf (diff) |
Native style: use the same scale from all places
To be on the safe side, let's ensure that we set the same scale
one the scene graph node as on the image it's created from
Pick-to: 6.0
Change-Id: Ib8a86dd29f6f458d4c43dd36c6838dd632cb4078
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/nativestyle/items/qquickstyleitem.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/imports/nativestyle/items/qquickstyleitem.cpp b/src/imports/nativestyle/items/qquickstyleitem.cpp index 38e7fd6d..b50a38c5 100644 --- a/src/imports/nativestyle/items/qquickstyleitem.cpp +++ b/src/imports/nativestyle/items/qquickstyleitem.cpp @@ -114,11 +114,13 @@ QSGNode *QQuickStyleItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePa QSGNinePatchNode *node = static_cast<QSGNinePatchNode *>(oldNode); if (!node) node = window()->createNinePatchNode(); + if (m_paintedImage.isNull()) + return node; auto texture = window()->createTextureFromImage(m_paintedImage, QQuickWindow::TextureCanUseAtlas); QRectF bounds = boundingRect(); - const qreal scale = window()->devicePixelRatio(); + const qreal scale = m_paintedImage.devicePixelRatioF(); const QSizeF ninePatchImageSize = m_paintedImage.rect().size() / scale; #ifdef QT_DEBUG if (m_debugFlags.testFlag(Unscaled)) { @@ -154,7 +156,7 @@ QSGNode *QQuickStyleItem::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePa node->setBounds(bounds); node->setTexture(texture); - node->setDevicePixelRatio(window()->devicePixelRatio()); + node->setDevicePixelRatio(scale); node->setPadding(padding.left(), padding.top(), padding.right(), padding.bottom()); node->update(); |