r20702 by fschmid -

scribus-commit scribus-commit at lists.scribus.net
Sat Jan 23 09:46:13 UTC 2016


Author: fschmid
Date: Sat Jan 23 09:46:13 2016
New Revision: 20702

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20702
Log:
Fixed Bug #12252: Wrong import of SVG gradient + Crash

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20702&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Sat Jan 23 09:46:13 2016
@@ -3663,6 +3663,16 @@
 {
 	VGradient gradient;
 	gradient.clearStops();
+	if (fill_gradient.Stops() < 2)
+	{
+		fill_gradient.clearStops();
+		const ScColor& col = m_Doc->PageColors["Black"];
+		QColor qcol = ScColorEngine::getRGBColor(col, m_Doc);
+		fill_gradient.addStop(qcol, 0.0, 0.5, 1.0, "Black", 100);
+		const ScColor& col2 = m_Doc->PageColors["White"];
+		qcol = ScColorEngine::getRGBColor(col2, m_Doc);
+		fill_gradient.addStop(qcol, 1.0, 0.5, 1.0, "White", 100);
+	}
 	QList<VColorStop*> cstops = fill_gradient.colorStops();
 	double lastStop = -1.0;
 	double actualStop = 0.0;

Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20702&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp	Sat Jan 23 09:46:13 2016
@@ -2475,6 +2475,7 @@
 				const GradientHelper& gradientHelper(m_gradients[key]);
 				if (gradientHelper.typeValid)
 					obj->FillGradientType = m_gradients[key].type;
+				key = m_gradients[key].reference;
 				if (obj->FillGradientType != 8)
 				{
 					if (gradientHelper.gradientValid)
@@ -2588,6 +2589,7 @@
 				const GradientHelper& gradientHelper(m_gradients[key]);
 				if (gradientHelper.typeValid)
 					obj->StrokeGradientType = gradientHelper.type;
+				key = m_gradients[key].reference;
 				if (obj->StrokeGradientType != 8)
 				{
 					if (gradientHelper.gradientValid)
@@ -3158,8 +3160,11 @@
 	}
 	parseColorStops(&gradhelper, e);
 	m_gradients.insert(id, gradhelper);
-	if (m_Doc->addGradient(id, gradhelper.gradient))
-		importedGradients.append(id);
+	if (gradhelper.gradientValid)
+	{
+		if (m_Doc->addGradient(id, gradhelper.gradient))
+			importedGradients.append(id);
+	}
 	importedGradTrans.insert(origName, id);
 }
 




More information about the scribus-commit mailing list