summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-11-18 09:01:51 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2015-11-18 09:01:51 +0100
commitc7934f2489e2eb9a539206bab35f335b1943c5bd (patch)
treea27d0ed6c001fe9432e2a0f28fb935acf9e4c65f /src/gui/image
parentf40593b11199fbef886bfcb6b210a214d8c3adf3 (diff)
parent08f9a1bd6ab9b1777ee5ba163d75e5c848c39eb4 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/corelib/io/qprocess.cpp src/corelib/io/qprocess_unix.cpp src/network/kernel/qnetworkinterface_winrt.cpp tools/configure/configureapp.cpp Change-Id: I47df00a01597d2e63b334b492b3b4221b29f58ea
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qicon.cpp11
-rw-r--r--src/gui/image/qicon.h3
-rw-r--r--src/gui/image/qimage.cpp4
-rw-r--r--src/gui/image/qpnghandler.pri7
4 files changed, 16 insertions, 9 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index cebe5ce5f9..cc00f5c172 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -1398,8 +1398,12 @@ QDebug operator<<(QDebug dbg, const QIcon &i)
Given base foo.png and a target dpr of 2.5, this function will look for
foo@3x.png, then foo@2x, then fall back to foo.png if not found.
+
+ \a sourceDevicePixelRatio will be set to the value of N if the argument is
+ a non-null pointer
*/
-QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio)
+QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio,
+ qreal *sourceDevicePixelRatio)
{
if (targetDevicePixelRatio <= 1.0)
return baseFileName;
@@ -1417,8 +1421,11 @@ QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRati
for (int n = qCeil(targetDevicePixelRatio); n > 1; --n) {
QString atNxfileName = baseFileName;
atNxfileName.insert(dotIndex, atNx.arg(n));
- if (QFile::exists(atNxfileName))
+ if (QFile::exists(atNxfileName)) {
+ if (sourceDevicePixelRatio)
+ *sourceDevicePixelRatio = n;
return atNxfileName;
+ }
}
return baseFileName;
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index 6808bc2828..989e40bbb5 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -140,7 +140,8 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &);
Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QIcon &);
#endif
-Q_GUI_EXPORT QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio);
+Q_GUI_EXPORT QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio,
+ qreal *sourceDevicePixelRatio = Q_NULLPTR);
QT_END_NAMESPACE
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index a69aae87f1..798002224a 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4388,6 +4388,8 @@ QImage QImage::smoothScaled(int w, int h) const {
static QImage rotated90(const QImage &image) {
QImage out(image.height(), image.width(), image.format());
+ out.setDotsPerMeterX(image.dotsPerMeterY());
+ out.setDotsPerMeterY(image.dotsPerMeterX());
if (image.colorCount() > 0)
out.setColorTable(image.colorTable());
int w = image.width();
@@ -4456,6 +4458,8 @@ static QImage rotated180(const QImage &image) {
static QImage rotated270(const QImage &image) {
QImage out(image.height(), image.width(), image.format());
+ out.setDotsPerMeterX(image.dotsPerMeterY());
+ out.setDotsPerMeterY(image.dotsPerMeterX());
if (image.colorCount() > 0)
out.setColorTable(image.colorTable());
int w = image.width();
diff --git a/src/gui/image/qpnghandler.pri b/src/gui/image/qpnghandler.pri
index 9ab175d628..505d214130 100644
--- a/src/gui/image/qpnghandler.pri
+++ b/src/gui/image/qpnghandler.pri
@@ -1,9 +1,4 @@
HEADERS += $$PWD/qpnghandler_p.h
SOURCES += $$PWD/qpnghandler.cpp
-contains(QT_CONFIG, system-png) {
- if(unix|mingw): LIBS_PRIVATE += -lpng
- else:win32: LIBS += libpng.lib
-} else {
- include($$PWD/../../3rdparty/libpng.pri)
-}
+include($$PWD/../../3rdparty/png_dependency.pri)