diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-15 20:57:16 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-02-15 20:57:16 +0100 |
commit | cb800de1f42aaacdeb423d30adbcbf8975e32f2f (patch) | |
tree | 7493c2b814c5f3c780fc7338c62660846fdb6e92 | |
parent | 14f86268e7f149a3c881203227321c3fd085e4d9 (diff) | |
parent | eaeeacd1d0efdf1e65c1742240b2a8d5219d5b94 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7v5.7.0-alpha1
Conflicts:
.qmake.conf
Change-Id: Id59a8238134f1b0e172b22cd7e95d984a3f66401
-rw-r--r-- | src/3rdparty/zlib_dependency.pri | 5 | ||||
-rw-r--r-- | src/plugins/imageformats/tiff/qtiffhandler.cpp | 15 | ||||
-rw-r--r-- | tests/auto/tiff/tst_qtiff.cpp | 1 |
3 files changed, 18 insertions, 3 deletions
diff --git a/src/3rdparty/zlib_dependency.pri b/src/3rdparty/zlib_dependency.pri index 4194fe2..5cccf37 100644 --- a/src/3rdparty/zlib_dependency.pri +++ b/src/3rdparty/zlib_dependency.pri @@ -1,7 +1,10 @@ # zlib dependency satisfied by bundled 3rd party zlib or system zlib contains(QT_CONFIG, system-zlib) { unix|mingw: LIBS_PRIVATE += -lz - else: LIBS += zdll.lib + else { + isEmpty(ZLIB_LIBS): LIBS += zdll.lib + else: LIBS += $$ZLIB_LIBS + } } else { QT_PRIVATE += zlib-private } diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp index e0c17ce..f72c2a0 100644 --- a/src/plugins/imageformats/tiff/qtiffhandler.cpp +++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp @@ -257,8 +257,19 @@ bool QTiffHandlerPrivate::openForRead(QIODevice *device) format = QImage::Format_Indexed8; else if (samplesPerPixel < 4) format = QImage::Format_RGB32; - else - format = QImage::Format_ARGB32_Premultiplied; + else { + uint16 count; + uint16 *extrasamples; + // If there is any definition of the alpha-channel, libtiff will return premultiplied + // data to us. If there is none, libtiff will not touch it and we assume it to be + // non-premultiplied, matching behavior of tested image editors, and how older Qt + // versions used to save it. + bool gotField = TIFFGetField(tiff, TIFFTAG_EXTRASAMPLES, &count, &extrasamples); + if (!gotField || !count || extrasamples[0] == EXTRASAMPLE_UNSPECIFIED) + format = QImage::Format_ARGB32; + else + format = QImage::Format_ARGB32_Premultiplied; + } headersRead = true; return true; diff --git a/tests/auto/tiff/tst_qtiff.cpp b/tests/auto/tiff/tst_qtiff.cpp index ec45b66..ae7d5a5 100644 --- a/tests/auto/tiff/tst_qtiff.cpp +++ b/tests/auto/tiff/tst_qtiff.cpp @@ -341,6 +341,7 @@ void tst_qtiff::writeImage() QImageWriter writer(&buf, format); QVERIFY(writer.write(image)); } + image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); QImage image2; { |