Responsive: OPENGL_GAL::DrawArc reserve linequads to reduce drawing time
(cherry picked from commit 77576e1a80
)
This commit is contained in:
parent
8b281b4d1c
commit
4e8d6de1de
|
@ -1005,11 +1005,20 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius,
|
||||||
|
|
||||||
VECTOR2D p( cos( startAngle ) * aRadius, sin( startAngle ) * aRadius );
|
VECTOR2D p( cos( startAngle ) * aRadius, sin( startAngle ) * aRadius );
|
||||||
double alpha;
|
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 )
|
for( alpha = startAngle + alphaIncrement; alpha <= endAngle; alpha += alphaIncrement )
|
||||||
{
|
{
|
||||||
VECTOR2D p_next( cos( alpha ) * aRadius, sin( alpha ) * aRadius );
|
VECTOR2D p_next( cos( alpha ) * aRadius, sin( alpha ) * aRadius );
|
||||||
DrawLine( p, p_next );
|
drawLineQuad( p, p_next, false );
|
||||||
|
|
||||||
p = p_next;
|
p = p_next;
|
||||||
}
|
}
|
||||||
|
@ -1018,7 +1027,7 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius,
|
||||||
if( alpha != endAngle )
|
if( alpha != endAngle )
|
||||||
{
|
{
|
||||||
VECTOR2D p_last( cos( endAngle ) * aRadius, sin( endAngle ) * aRadius );
|
VECTOR2D p_last( cos( endAngle ) * aRadius, sin( endAngle ) * aRadius );
|
||||||
DrawLine( p, p_last );
|
drawLineQuad( p, p_last, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue