r15204 by jghali - #9178: inconsistency between gradient display and pdf/svg export Fix remaining inconsistency, gradient with stops at same ramp point must be avoided due to unpredictable behavior

scribus-commit scribus-commit at lists.scribus.net
Thu Jun 17 01:20:22 CEST 2010


Revision: 15204
Author: jghali
Date: 2010-06-16T23:18:14.960581Z
Commit message: #9178: inconsistency between gradient display and pdf/svg export
Fix remaining inconsistency, gradient with stops at same ramp point must be avoided due to unpredictable behavior

Changeset: 
M  /trunk/Scribus/scribus/pdflib_core.cpp

Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp	(revision 15203)
+++ scribus/pdflib_core.cpp	(revision 15204)
@@ -7634,11 +7634,15 @@
 		mpa.translate(-StartX, StartY);
 		mpa.scale(1, Gscale);
 	}
-	bool transparencyFound = false;
+	double lastStop = -1.0;
+	double actualStop = 0.0;
+	bool   isFirst = true, transparencyFound = false;
 	for (uint cst = 0; cst < gradient.Stops(); ++cst)
 	{
-		double actualStop = cstops.at(cst)->rampPoint;
-		if ((cst == 0) && (actualStop != 0.0))
+		actualStop = cstops.at(cst)->rampPoint;
+		if ((actualStop == lastStop) && (!isFirst))
+			continue;
+		if ((isFirst) && (actualStop != 0.0))
 		{
 			StopVec.append(0.0);
 			colorNames.append(cstops.at(cst)->name);
@@ -7646,6 +7650,7 @@
 			TransVec.append(cstops.at(cst)->opacity);
 			Gcolors.append(SetGradientColor(cstops.at(cst)->name, cstops.at(cst)->shade));
 		}
+		isFirst = false;
 		StopVec.append(actualStop);
 		colorNames.append(cstops.at(cst)->name);
 		colorShades.append(cstops.at(cst)->shade);
@@ -7666,6 +7671,7 @@
 			TransVec.append(cstops.at(cst)->opacity);
 			Gcolors.append(SetGradientColor(cstops.at(cst)->name, cstops.at(cst)->shade));
 		}
+		lastStop = actualStop;
 	}
 	QString TRes("");
 	if (((Options.Version >= PDFOptions::PDFVersion_14) || (Options.Version == PDFOptions::PDFVersion_X4)) && (transparencyFound))




More information about the scribus-commit mailing list