From 4e8d6de1dee0136874d461cc73fa4d974d458c2f Mon Sep 17 00:00:00 2001 From: Yon Uriarte Date: Mon, 4 Mar 2024 09:18:25 +0100 Subject: [PATCH] Responsive: OPENGL_GAL::DrawArc reserve linequads to reduce drawing time (cherry picked from commit 77576e1a80adfee329f31e9c2c3745ca70753fdf) --- common/gal/opengl/opengl_gal.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 4ae2241c2c..eed5a1c059 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -1005,11 +1005,20 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, VECTOR2D p( cos( startAngle ) * aRadius, sin( startAngle ) * aRadius ); double alpha; + unsigned int lineCount = 0; + + for( alpha = startAngle + alphaIncrement; alpha <= endAngle; alpha += alphaIncrement ) + lineCount++; + + if( alpha != endAngle ) + lineCount++; + + reserveLineQuads( lineCount ); for( alpha = startAngle + alphaIncrement; alpha <= endAngle; alpha += alphaIncrement ) { VECTOR2D p_next( cos( alpha ) * aRadius, sin( alpha ) * aRadius ); - DrawLine( p, p_next ); + drawLineQuad( p, p_next, false ); p = p_next; } @@ -1018,7 +1027,7 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius, if( alpha != endAngle ) { VECTOR2D p_last( cos( endAngle ) * aRadius, sin( endAngle ) * aRadius ); - DrawLine( p, p_last ); + drawLineQuad( p, p_last, false ); } }