diff --git a/autotests/read/psd/birthday.png b/autotests/read/psd/birthday.png deleted file mode 100644 index a79391f..0000000 Binary files a/autotests/read/psd/birthday.png and /dev/null differ diff --git a/autotests/read/psd/birthday.tif b/autotests/read/psd/birthday.tif new file mode 100644 index 0000000..7e0d5f0 Binary files /dev/null and b/autotests/read/psd/birthday.tif differ diff --git a/autotests/readtest.cpp b/autotests/readtest.cpp index bf0fb07..7710844 100644 --- a/autotests/readtest.cpp +++ b/autotests/readtest.cpp @@ -159,17 +159,22 @@ int main(int argc, char **argv) QTextStream(stdout) << "* Run on RANDOM ACCESS device\n"; } for (const QFileInfo &fi : lstImgDir) { - if (!fi.suffix().compare("png", Qt::CaseInsensitive)) { + if (!fi.suffix().compare("png", Qt::CaseInsensitive) || !fi.suffix().compare("tif", Qt::CaseInsensitive)) { continue; } int suffixPos = fi.filePath().count() - suffix.count(); QString inputfile = fi.filePath(); - QString expfile = fi.filePath().replace(suffixPos, suffix.count(), QStringLiteral("png")); + QString fmt = QStringLiteral("png"); + QString expfile = fi.filePath().replace(suffixPos, suffix.count(), fmt); + if (!QFile::exists(expfile)) { // try with tiff + fmt = QStringLiteral("tif"); + expfile = fi.filePath().replace(suffixPos, suffix.count(), fmt); + } QString expfilename = QFileInfo(expfile).fileName(); std::unique_ptr inputDevice(seq ? new SequentialFile(inputfile) : new QFile(inputfile)); QImageReader inputReader(inputDevice.get(), format); - QImageReader expReader(expfile, "png"); + QImageReader expReader(expfile, fmt.toLatin1()); QImage inputImage; QImage expImage; diff --git a/src/imageformats/psd.cpp b/src/imageformats/psd.cpp index 3ea66d7..be01159 100644 --- a/src/imageformats/psd.cpp +++ b/src/imageformats/psd.cpp @@ -847,8 +847,7 @@ inline void premulConversion(char *stride, qint32 width, qint32 ac, qint32 cn, c for (qint32 x = 0; x < width; ++x) { auto xcn = x * cn; auto alpha = *(s + xcn + ac); - if (alpha > 0) - *(s + xcn + c) = *(s + xcn + c) + alpha - max; + *(s + xcn + c) = *(s + xcn + c) + alpha - max; } } else if (conv == PremulConversion::PS2A || (conv == PremulConversion::PSLab2A && c == 0)) { for (qint32 x = 0; x < width; ++x) {