aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2023-01-05 17:26:20 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-01-10 11:02:06 +0000
commit713a6814502b53f069e2f5fbe0a97fbe983a22e7 (patch)
tree55dd3e8f995dab4b4b016137659004d89f6e6a18
parent44300743a2793c1833f880f13cc052c654293fb1 (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>
-rw-r--r--src/quick/items/qquickimagebase.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index f10446b7b5..78dfecc42a 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -291,8 +291,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