r15045 by fschmid - Fixed Bug #9076: "SVG file crashes Scribus"

scribus-commit scribus-commit at lists.scribus.net
Tue May 4 23:11:05 CEST 2010


Revision: 15045
Author: fschmid
Date: 2010-05-04T21:06:24.210936Z
Commit message: Fixed Bug #9076: "SVG file crashes Scribus"

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

Diffs:
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp	(revision 15044)
+++ scribus/pageitem.cpp	(revision 15045)
@@ -6699,7 +6699,6 @@
 
 void PageItem::setPolyClip(int up, int down)
 {
-	Clip.resize(0);
 	if (PoLine.size() < 4)
 		return;
 	double rot;
@@ -6715,32 +6714,36 @@
 	QPoint np, np2;
 	QPolygon cl, cl1, cl2;
 	cl = FlattenPath(PoLine, Segments);
-	for (int a = 0; a < cl.size()-1; ++a)
+	if (cl.size() > 1)
 	{
-		rot = xy2Deg(cl.point(a+1).x()-cl.point(a).x(),cl.point(a+1).y()-cl.point(a).y());
-		QTransform ma;
-		ma.rotate(rot);
-		np = QPoint(0, -upval) * ma;
-		np2 = QPoint(0, -downval) * ma;
+		Clip.resize(0);
+		for (int a = 0; a < cl.size()-1; ++a)
+		{
+			rot = xy2Deg(cl.point(a+1).x()-cl.point(a).x(),cl.point(a+1).y()-cl.point(a).y());
+			QTransform ma;
+			ma.rotate(rot);
+			np = QPoint(0, -upval) * ma;
+			np2 = QPoint(0, -downval) * ma;
+			cl1.resize(cl1.size()+1);
+			cl1.setPoint(cl1.size()-1, np+cl.point(a));
+			cl1.resize(cl1.size()+1);
+			cl1.setPoint(cl1.size()-1, np+cl.point(a+1));
+			cl2.resize(cl2.size()+1);
+			cl2.setPoint(cl2.size()-1, np2+cl.point(a));
+			cl2.resize(cl2.size()+1);
+			cl2.setPoint(cl2.size()-1, np2+cl.point(a+1));
+		}
 		cl1.resize(cl1.size()+1);
-		cl1.setPoint(cl1.size()-1, np+cl.point(a));
-		cl1.resize(cl1.size()+1);
-		cl1.setPoint(cl1.size()-1, np+cl.point(a+1));
+		cl1.setPoint(cl1.size()-1, np+cl.point(cl.size()-1));
 		cl2.resize(cl2.size()+1);
-		cl2.setPoint(cl2.size()-1, np2+cl.point(a));
-		cl2.resize(cl2.size()+1);
-		cl2.setPoint(cl2.size()-1, np2+cl.point(a+1));
+		cl2.setPoint(cl2.size()-1, np2+cl.point(cl.size()-1));
+		Clip.putPoints(Clip.size(), cl1.size(), cl1);
+		for (int a2 = cl2.size()-1; a2 > -1; a2--)
+		{
+			Clip.resize(Clip.size()+1);
+			Clip.setPoint(Clip.size()-1, cl2.point(a2));
+		}
 	}
-	cl1.resize(cl1.size()+1);
-	cl1.setPoint(cl1.size()-1, np+cl.point(cl.size()-1));
-	cl2.resize(cl2.size()+1);
-	cl2.setPoint(cl2.size()-1, np2+cl.point(cl.size()-1));
-	Clip.putPoints(Clip.size(), cl1.size(), cl1);
-	for (int a2 = cl2.size()-1; a2 > -1; a2--)
-	{
-		Clip.resize(Clip.size()+1);
-		Clip.setPoint(Clip.size()-1, cl2.point(a2));
-	}
 }
 
 void PageItem::updatePolyClip()




More information about the scribus-commit mailing list