fixed rendering artifacts

Sat, 24 Mar 2018 23:46:25 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 24 Mar 2018 23:46:25 +0200
changeset 1344
d28f6ff1b1f0
parent 1343
f33ca184c76d
child 1345
1e345ed80a1d

fixed rendering artifacts

src/editmodes/circleMode.cpp file | annotate | diff | comparison | revisions
--- 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