mirror of
				https://invent.kde.org/frameworks/kimageformats.git
				synced 2025-11-03 13:24:20 -05:00 
			
		
		
		
	PSD: fix test failure on some systems and fix wrong check on alpha conversion
- Fix PSD alpha conversion - Fix autoread test to use also TIFF images
This commit is contained in:
		
				
					committed by
					
						
						Albert Astals Cid
					
				
			
			
				
	
			
			
			
						parent
						
							e1a3751936
						
					
				
				
					commit
					41f0411b62
				
			
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 93 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								autotests/read/psd/birthday.tif
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								autotests/read/psd/birthday.tif
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@ -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().size() - suffix.size();
 | 
			
		||||
            QString inputfile = fi.filePath();
 | 
			
		||||
            QString expfile = fi.filePath().replace(suffixPos, suffix.size(), QStringLiteral("png"));
 | 
			
		||||
            QString fmt = QStringLiteral("png");
 | 
			
		||||
            QString expfile = fi.filePath().replace(suffixPos, suffix.size(), fmt);
 | 
			
		||||
            if (!QFile::exists(expfile)) { // try with tiff
 | 
			
		||||
                fmt = QStringLiteral("tif");
 | 
			
		||||
                expfile = fi.filePath().replace(suffixPos, suffix.size(), fmt);
 | 
			
		||||
            }
 | 
			
		||||
            QString expfilename = QFileInfo(expfile).fileName();
 | 
			
		||||
 | 
			
		||||
            std::unique_ptr<QIODevice> 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;
 | 
			
		||||
 | 
			
		||||
@ -865,7 +865,6 @@ 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;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user