r14090 by fschmid - WPG Image loader and WPG import: fix for incorrect gradient color positions.

scribus-commit scribus-commit at lists.scribus.net
Sun Oct 4 21:25:19 CEST 2009


Revision: 14090
Author: fschmid
Date: 2009-10-04T19:26:23.298694Z
Commit message: WPG Image loader and WPG import: fix for incorrect gradient color positions.

Changeset: 
M  /trunk/Scribus/scribus/plugins/wpgimplugin/importwpg.cpp
M  /trunk/Scribus/scribus/scimgdataloader_wpg.cpp

Diffs:
Index: scribus/scimgdataloader_wpg.cpp
===================================================================
--- scribus/scimgdataloader_wpg.cpp	(revision 14089)
+++ scribus/scimgdataloader_wpg.cpp	(revision 14090)
@@ -125,7 +125,8 @@
 		for(unsigned c = 0; c < brush.gradient.count(); c++)
 		{
 			QColor stopC = QColor(brush.gradient.stopColor(c).red, brush.gradient.stopColor(c).green, brush.gradient.stopColor(c).blue);
-			currentGradient.setColorAt(fabs(brush.gradient.stopOffset(c)), stopC);
+			double pos = qBound(0.0, fabs(brush.gradient.stopOffset(c)), 1.0);
+			currentGradient.setColorAt(pos, stopC);
 		}
 	}
 	else if (brush.style == libwpg::WPGBrush::NoBrush)
Index: scribus/plugins/wpgimplugin/importwpg.cpp
===================================================================
--- scribus/plugins/wpgimplugin/importwpg.cpp	(revision 14089)
+++ scribus/plugins/wpgimplugin/importwpg.cpp	(revision 14090)
@@ -262,7 +262,8 @@
 				currStopColor = newColorName;
 			}
 			const ScColor& gradC = m_Doc->PageColors[currStopColor];
-			currentGradient.addStop( ScColorEngine::getRGBColor(gradC, m_Doc), fabs(brush.gradient.stopOffset(c)), 0.5, 1.0, currStopColor, 100 );
+			double pos = qBound(0.0, fabs(brush.gradient.stopOffset(c)), 1.0);
+			currentGradient.addStop( ScColorEngine::getRGBColor(gradC, m_Doc), pos, 0.5, 1.0, currStopColor, 100 );
 		}
 	}
 	else if (brush.style == libwpg::WPGBrush::NoBrush)




More information about the scribus-commit mailing list