r25071 by craig - Code cleanup: simplify condition and loop of ProofImage

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 30 18:58:30 UTC 2022


Author: craig
Date: Wed Mar 30 18:58:30 2022
New Revision: 25071

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25071
Log:
Code cleanup: simplify condition and loop of ProofImage

Modified:
    trunk/Scribus/scribus/util_color.cpp

Modified: trunk/Scribus/scribus/util_color.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25071&path=/trunk/Scribus/scribus/util_color.cpp
==============================================================================
--- trunk/Scribus/scribus/util_color.cpp	(original)
+++ trunk/Scribus/scribus/util_color.cpp	Wed Mar 30 18:58:30 2022
@@ -52,8 +52,6 @@
 
 void handleOldColorShade(ScribusDoc* doc, QString& colName, int& shade)
 {
-	int r, g, b;
-	bool found = false;
 	if (colName.isEmpty() || colName == CommonStrings::None || !doc->PageColors.contains(colName))
 		return;
 
@@ -61,6 +59,8 @@
 	
 	if ((shade == 100) || (scCol1.getColorModel() != colorModelRGB))
 		return;
+	int r, g, b;
+	bool found = false;
 	scCol1.getRGB(&r, &g, &b);
 	QColor col1 = getOldColorShade(r, g, b, shade), col2;
 	ColorList::Iterator it, itEnd = doc->PageColors.end();
@@ -118,27 +118,15 @@
 {
 	QImage out = Image->copy();
 	bool cmsUse = doc ? doc->HasCMS : false;
-	bool softProofing = doc ? doc->SoftProofing : false;
-	if (cmsUse && softProofing)
-	{
-		int outheight = out.height();
-		for (int i=0; i < outheight; ++i)
-		{
-			uchar* ptr = out.scanLine(i);
-			doc->stdProofImg.apply(ptr, ptr, out.width());
-		}
-	}
-	else
-	{
-		if (cmsUse)
-		{
-			int outheight=out.height();
-			for (int i=0; i < outheight; ++i)
-			{
-				uchar* ptr = out.scanLine(i);
-				doc->stdTransImg.apply(ptr, ptr, out.width());
-			}
-		}
+	if (!cmsUse)
+		return out;
+	int outHeight=out.height();
+	int outWidth=out.width();
+	ScColorTransform trans = doc->SoftProofing ? doc->stdProofImg : doc->stdTransImg;
+	for (int i=0; i < outHeight; ++i)
+	{
+		uchar* ptr = out.scanLine(i);
+		trans.apply(ptr, ptr, outWidth);
 	}
 	return out;
 }




More information about the scribus-commit mailing list