* "divisions" could be lower than 1. This fixes bug #510.

* Moved expensive computation out of the max_c() macro.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17709 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-06-03 14:14:59 +00:00
parent 82c410dc12
commit a17be10094
+6 -3
View File
@@ -853,10 +853,13 @@ Painter::DrawEllipse(BRect r, bool fill) const
float xRadius = r.Width() / 2.0;
float yRadius = r.Height() / 2.0;
BPoint center(r.left + xRadius,
r.top + yRadius);
BPoint center(r.left + xRadius, r.top + yRadius);
int32 divisions = (int32)max_c(12, (xRadius + yRadius + 2 * fPenSize) * PI / 2);
int32 divisions = (int32)((xRadius + yRadius + 2 * fPenSize) * PI / 2);
if (divisions > 12)
divisions = 12;
if (divisions < 1)
divisions = 1;
if (fill) {
agg::ellipse path(center.x, center.y, xRadius, yRadius, divisions);