src/editmodes/circleMode.cpp

changeset 1344
d28f6ff1b1f0
parent 1339
1f342d5abc85
child 1390
3eace926af7f
--- a/src/editmodes/circleMode.cpp	Sat Mar 24 23:45:24 2018 +0200
+++ b/src/editmodes/circleMode.cpp	Sat Mar 24 23:46:25 2018 +0200
@@ -206,8 +206,8 @@
 	// Calculate the preview positions of vertices
 	for (int i = 0; i < segments + 1; ++i)
 	{
-		const double sinangle (sin (angleoffset + i * angleUnit));
-		const double cosangle (cos (angleoffset + i * angleUnit));
+		const double sinangle = ldrawsin(angleoffset + i * angleUnit);
+		const double cosangle = ldrawcos(angleoffset + i * angleUnit);
 		Vertex vertex;
 		vertex.setCoordinate (relX, m_drawedVerts[0][relX] + (cosangle * innerdistance));
 		vertex.setCoordinate (relY, m_drawedVerts[0][relY] + (sinangle * innerdistance));
@@ -223,12 +223,13 @@
 		}
 	}
 
-	QVector<QLineF> lines {segments};
+	QVector<QLineF> lines;
 
 	if (outerdistance != -1 and outerdistance != innerdistance)
 	{
 		painter.setBrush(m_polybrush);
 		painter.setPen(Qt::NoPen);
+		lines.reserve(segments * 2);
 
 		// Compile polygons
 		for (int i = 0; i < segments; ++i)
@@ -252,6 +253,8 @@
 	}
 	else
 	{
+		lines.reserve(segments);
+
 		for (int i = 0; i < segments; ++i)
 			lines.append({innerverts2d[i], innerverts2d[i + 1]});
 	}

mercurial