r16488 by fschmid - Regression: Fixed nonworking rounded rectangles when cornerradius is negative.

scribus-commit scribus-commit at lists.scribus.net
Thu Mar 24 12:29:47 CET 2011


Author: fschmid
Date: Thu Mar 24 11:29:47 2011
New Revision: 16488

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16488
Log:
Regression: Fixed nonworking rounded rectangles when cornerradius is negative.

Modified:
    trunk/Scribus/scribus/pageitem.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16488&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Thu Mar 24 11:29:47 2011
@@ -5002,9 +5002,27 @@
 	setCornerRadius(qMin(RadRect, qMin(Width,Height)/2));
 	PoLine.resize(0);
 	double rr = fabs(RadRect);
-	QPainterPath path;
-	path.addRoundedRect(0, 0, Width, Height, rr, rr);
-	PoLine.fromQPainterPath(path);
+	if (RadRect > 0.0)
+	{
+		QPainterPath path;
+		path.addRoundedRect(0, 0, Width, Height, rr, rr);
+		PoLine.fromQPainterPath(path);
+	}
+	else
+	{
+		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;
+		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);
+	}
 	Clip = FlattenPath(PoLine, Segments);
 	ClipEdited = false;
 	FrameType = 2;




More information about the scribus-commit mailing list