aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJocelyn Turcotte <jturcotte@woboq.com>2015-05-20 16:29:45 +0200
committerJocelyn Turcotte (Woboq GmbH) <jturcotte@woboq.com>2015-05-22 14:52:10 +0000
commit1ebee6e995541554aa9250ccf3326d2579c237c6 (patch)
treee75c1d8dc5144d0702df44798a9b7979c88f5d1a /src
parentb8db3a1c6036e6d8ab68b5f1c01a00c289a67ab8 (diff)
Fix the implicitSize of SVG Images on retina display
If the user relies on the Image implicitSize to do the layout but still sets sourceSize to the image, the sourceSize might be (0, 0) instead of (-1, -1). readImage checks that the size is > 0 to use the requestedSize and this would cause us not to use the requestedSize, but still divide by the devicePixelRatio in QQuickImageBase::pixmapChange, which would give a different implicitSize on retina display. Make sure that we get the same implicitSize on both by only keeping the targetDevicePixelRatio if sourceSize is > (0, 0) like readImage does. Task-number: QTBUG-38991 Change-Id: Ib93f57efa47d096f88883845985b44f62db4ad74 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickimagebase.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp
index 8fba6e3d12..0e2134842b 100644
--- a/src/quick/items/qquickimagebase.cpp
+++ b/src/quick/items/qquickimagebase.cpp
@@ -219,7 +219,7 @@ void QQuickImageBase::load()
// QQuickImageProvider and SVG can generate a high resolution image when
// sourceSize is set. If sourceSize is not set then the provider default size
// will be used, as usual.
- if (d->sourcesize.isValid())
+ if (!d->sourcesize.isEmpty())
d->devicePixelRatio = targetDevicePixelRatio;
} else {
// (possible) local file: loadUrl and d->devicePixelRatio will be modified if