diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2023-01-05 17:26:20 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-01-16 08:08:15 +0000 |
commit | 8017d84016b511bb203f6566386f063d7090a664 (patch) | |
tree | aab4774f10652416521dc2539229b1ba0738848d /src | |
parent | 8e4065ad36624e20ef49cf32f54b8cf98d270b65 (diff) |
Ignore DPR for image providers if the requested size is not set
If the requested size is not set, the QQuickImageBasePrivate::sourcesize
is -1. Multiplying it with devicePixelRatio is useless because it will
be still an invalid size and it will be ignored. Nonetheless,
QQuickImageBase::pixmapChange() will still divide the size with
devicePixelRatio resulting smaller images.
The issue is reproducible with the tst_qquickimageprovider auto test if
ran with QT_SCALE_FACTOR=2 set.
Fixes: QTBUG-109854
Change-Id: I9fea39c34144e5eae7e421bccc8dc65388dd5b32
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
(cherry picked from commit 1609f8628d1469f723a762c60ccb5856637956dc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickimagebase.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp index 21f399e608..f278222766 100644 --- a/src/quick/items/qquickimagebase.cpp +++ b/src/quick/items/qquickimagebase.cpp @@ -327,8 +327,10 @@ void QQuickImageBase::loadPixmap(const QUrl &url, LoadPixmapOptions loadOptions) const qreal targetDevicePixelRatio = (window() ? window()->effectiveDevicePixelRatio() : qApp->devicePixelRatio()); d->devicePixelRatio = 1.0; bool updatedDevicePixelRatio = false; - if (d->sourcesize.isValid() || isScalableImageFormat(d->url)) + if (d->sourcesize.isValid() + || (isScalableImageFormat(d->url) && d->url.scheme() != QLatin1String("image"))) { updatedDevicePixelRatio = d->updateDevicePixelRatio(targetDevicePixelRatio); + } if (!updatedDevicePixelRatio) { // (possible) local file: loadUrl and d->devicePixelRatio will be modified if |