r16285 by fschmid - Use the QPainterPath::addRoundedRect() function for our rounded Rects.

scribus-commit scribus-commit at lists.scribus.net
Wed Jan 19 23:10:32 CET 2011


Author: fschmid
Date: Wed Jan 19 22:10:32 2011
New Revision: 16285

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16285
Log:
Use the QPainterPath::addRoundedRect() function for our rounded Rects.

Modified:
    trunk/Scribus/scribus/pageitem.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16285&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Wed Jan 19 22:10:32 2011
@@ -4988,32 +4988,9 @@
 	setCornerRadius(qMin(RadRect, qMin(Width,Height)/2));
 	PoLine.resize(0);
 	double rr = fabs(RadRect);
-	double bezierFactor=0.552284749; //Bezier Control Point Factor: 8/3*(sin(45)-0.5)
-	double rrxBezierFactor=rr*bezierFactor;
-	double Width_rr=Width-rr;
-	double Height_rr=Height-rr;
-	if (RadRect > 0)
-	{
-		PoLine.addQuadPoint(rr, 0, rr, 0, Width_rr, 0, Width_rr, 0);
-		PoLine.addQuadPoint(Width_rr, 0, Width_rr+rrxBezierFactor, 0, Width, rr, Width, rrxBezierFactor);
-		PoLine.addQuadPoint(Width, rr, Width, rr, Width, Height_rr, Width, Height_rr);
-		PoLine.addQuadPoint(Width, Height_rr, Width, Height_rr+rrxBezierFactor, Width_rr, Height, Width_rr+rrxBezierFactor, Height);
-		PoLine.addQuadPoint(Width_rr, Height, Width_rr, Height, rr, Height, rr, Height);
-		PoLine.addQuadPoint(rr, Height, rrxBezierFactor, Height, 0, Height_rr, 0, Height_rr+rrxBezierFactor);
-		PoLine.addQuadPoint(0, Height_rr, 0, Height_rr, 0, rr, 0, rr);
-		PoLine.addQuadPoint(0, rr, 0, rrxBezierFactor, rr, 0, rr*bezierFactor, 0);
-	}
-	else
-	{
-		PoLine.addQuadPoint(rr, 0, rr, 0, Width_rr, 0, Width_rr, 0);
-		PoLine.addQuadPoint(Width_rr, 0, Width_rr, rrxBezierFactor, Width, rr, Width-rrxBezierFactor, rr);
-		PoLine.addQuadPoint(Width, rr, Width, rr, Width, Height_rr, Width, Height_rr);
-		PoLine.addQuadPoint(Width, Height_rr, Width-rrxBezierFactor, Height_rr, Width_rr, Height, Width_rr, Height-rrxBezierFactor);
-		PoLine.addQuadPoint(Width_rr, Height, Width_rr, Height, rr, Height, rr, Height);
-		PoLine.addQuadPoint(rr, Height, rr, Height-rrxBezierFactor, 0, Height_rr, rrxBezierFactor, Height_rr);
-		PoLine.addQuadPoint(0, Height_rr, 0, Height_rr, 0, rr, 0, rr);
-		PoLine.addQuadPoint(0, rr, rrxBezierFactor, rr, rr, 0, rr, rr*bezierFactor);
-	}
+	QPainterPath path;
+	path.addRoundedRect(0, 0, Width, Height, rr, rr);
+	PoLine.fromQPainterPath(path);
 	Clip = FlattenPath(PoLine, Segments);
 	ClipEdited = false;
 	FrameType = 2;




More information about the scribus-commit mailing list