r22574 by jghali - mitigate some print preview issues caused by some broken checks of sRGB profiles in recent libpng versions

scribus-commit scribus-commit at lists.scribus.net
Sun Jun 3 18:36:10 UTC 2018


Author: jghali
Date: Sun Jun  3 18:36:09 2018
New Revision: 22574

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22574
Log:
mitigate some print preview issues caused by some broken checks of sRGB profiles in recent libpng versions

Modified:
    trunk/Scribus/scribus/ui/preview.cpp

Modified: trunk/Scribus/scribus/ui/preview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22574&path=/trunk/Scribus/scribus/ui/preview.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/preview.cpp	(original)
+++ trunk/Scribus/scribus/ui/preview.cpp	Sun Jun  3 18:36:09 2018
@@ -126,13 +126,13 @@
 	Layout2->setAlignment( Qt::AlignTop );
 	AntiAlias = new QCheckBox(devTitle);
 	AntiAlias->setText( tr("Enable &Antialiasing"));
-	AntiAlias->setChecked( postscriptPreview ? prefsManager->appPrefs.printPreviewPrefs.PrPr_AntiAliasing : false);
-	AntiAlias->setEnabled( postscriptPreview );
+	AntiAlias->setChecked(postscriptPreview ? prefsManager->appPrefs.printPreviewPrefs.PrPr_AntiAliasing : false);
+	AntiAlias->setEnabled(postscriptPreview);
 	Layout2->addWidget(AntiAlias);
 	AliasTr = new QCheckBox(devTitle);
 	AliasTr->setText( tr("Display Trans&parency"));
-	AliasTr->setChecked(prefsManager->appPrefs.printPreviewPrefs.PrPr_Transparency);
-	AliasTr->setEnabled( postscriptPreview );
+	AliasTr->setChecked(postscriptPreview ? prefsManager->appPrefs.printPreviewPrefs.PrPr_Transparency : false);
+	AliasTr->setEnabled(postscriptPreview);
 	Layout2->addWidget(AliasTr);
 	EnableCMYK = new QCheckBox(devTitle);
 	EnableCMYK->setText( tr("&Display CMYK"));
@@ -554,13 +554,15 @@
 	{
 		if (HaveTiffSep)
 			args.append( "-sDEVICE=tiffsep" );
+		else
+			return 1;
 	}
 	else
 	{
-		if ((!AliasTr->isChecked()) || (!HavePngAlpha))
-			args.append( "-sDEVICE=png16m" );
+		if (AliasTr->isChecked() && HavePngAlpha)
+			args.append("-sDEVICE=pngalpha");
 		else
-			args.append( "-sDEVICE=pngalpha" );
+			args.append("-sDEVICE=tiff24nc");	
 	}
 	if (AntiAlias->isChecked())
 	{
@@ -596,8 +598,10 @@
 	// then add any final args and call gs
 	if (EnableCMYK->isChecked())
 		args.append( QString("-sOutputFile=%1").arg(QDir::toNativeSeparators(ScPaths::tempFileDir()+"/sc.tif")) );
+	else if ((AliasTr->isChecked() && HavePngAlpha) || !postscriptPreview)
+		args.append( QString("-sOutputFile=%1").arg(QDir::toNativeSeparators(ScPaths::tempFileDir()+"/sc.png")) );
 	else
-		args.append( QString("-sOutputFile=%1").arg(QDir::toNativeSeparators(ScPaths::tempFileDir()+"/sc.png")) );
+		args.append(QString("-sOutputFile=%1").arg(QDir::toNativeSeparators(ScPaths::tempFileDir() + "/sc.tif")));
 	args.append( QDir::toNativeSeparators(ScPaths::tempFileDir()+"/tmp.ps") );
 	args.append( "-c" );
 	args.append( "showpage" );
@@ -1102,7 +1106,12 @@
 	}
 	else
 	{
-		if (!image.load(ScPaths::tempFileDir()+"/sc.png"))
+		QString previewFile;
+		if ((AliasTr->isChecked() && HavePngAlpha) || !postscriptPreview)
+			previewFile = ScPaths::tempFileDir() + "/sc.png";
+		else
+			previewFile = ScPaths::tempFileDir() + "/sc.tif";
+		if (!image.load(previewFile))
 		{
 			imageLoadError(pixmap, pageIndex);
 			return pixmap;




More information about the scribus-commit mailing list