[RFC,v2,1/5] kernel-shark: Simplify the drawing of the Triangle Fan
diff mbox series

Message ID 20190703121023.16655-2-y.karadz@gmail.com
State New
Headers show
Series
  • Add support for text rendering
Related show

Commit Message

Yordan Karadzhov (VMware) July 3, 2019, 12:10 p.m. UTC
The central vertex of the Triangle Fan doesn't need to be an internal
point. The first point of the polygon can be used instead.

Suggested-by: Slavomir Kaslev <kaslevs@vmware.com>
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/libkshark-plot.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Patch
diff mbox series

diff --git a/kernel-shark/src/libkshark-plot.c b/kernel-shark/src/libkshark-plot.c
index 17d3b90..cdd0ef8 100644
--- a/kernel-shark/src/libkshark-plot.c
+++ b/kernel-shark/src/libkshark-plot.c
@@ -162,18 +162,9 @@  void ksplot_draw_polygon(const struct ksplot_point *points,
 		return;
 	}
 
-	/* Obtain a point inside the surface of the polygon. */
-	struct ksplot_point in_point;
-	in_point.x = (points[0].x + points[2].x) / 2;
-	in_point.y = (points[0].y + points[2].y) / 2;
-
-	/*
-	 * Draw a Triangle Fan using the internal point as a central
-	 * vertex.
-	 */
+	/* Draw a Triangle Fan. */
 	glBegin(GL_TRIANGLE_FAN);
 	glColor3ub(col->red, col->green, col->blue);
-	glVertex2i(in_point.x, in_point.y);
 	for (size_t i = 0; i < n_points; ++i)
 		glVertex2i(points[i].x, points[i].y);