summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-06-20 07:50:44 +0200
committerLiang Qi <liang.qi@qt.io>2019-06-20 07:50:44 +0200
commitbd9959bde290168b0635cb878d7d189e1f9c4b4f (patch)
tree1a4d5a0eff8d6acaff26ae4ff4ded8ca71b76a06 /src/gui/image
parentb877285694501d16b2bb0dc8d1a92e185b079b87 (diff)
parent6398588338dfea4161704e01216ba70b216a7a0b (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts: .qmake.conf src/gui/painting/qdrawhelper.cpp src/network/ssl/qsslsocket_openssl.cpp src/widgets/styles/qstylesheetstyle.cpp Change-Id: Ibe1cd40f46a823c9e5edbe0a3cd16be1e1686b17
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qimagereader.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 61f20e0c65..ade6a9eaaa 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1319,10 +1319,12 @@ bool QImageReader::read(QImage *image)
}
}
- // successful read; check for "@2x" file name suffix and set device pixel ratio.
- static bool disable2xImageLoading = !qEnvironmentVariableIsEmpty("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING");
- if (!disable2xImageLoading && QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) {
- image->setDevicePixelRatio(2.0);
+ // successful read; check for "@Nx" file name suffix and set device pixel ratio.
+ static bool disableNxImageLoading = !qEnvironmentVariableIsEmpty("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING");
+ if (!disableNxImageLoading) {
+ const QByteArray suffix = QFileInfo(fileName()).baseName().right(3).toLatin1();
+ if (suffix.length() == 3 && suffix[0] == '@' && suffix[1] >= '2' && suffix[1] <= '9' && suffix[2] == 'x')
+ image->setDevicePixelRatio(suffix[1] - '0');
}
if (autoTransform())
qt_imageTransform(*image, transformation());