OpenGL: Make circle/arc drawing match Cairo for some edge cases

This commit is contained in:
Jon Evans 2018-03-08 22:04:33 -05:00
parent eeeed88425
commit 921e68107b
2 changed files with 8 additions and 2 deletions

View File

@ -191,8 +191,8 @@ void filledCircle( vec2 aCoord )
void strokedCircle( vec2 aCoord, float aRadius, float aWidth )
{
float outerRadius = aRadius + ( aWidth / 2 );
float innerRadius = aRadius - ( aWidth / 2 );
float outerRadius = max( aRadius + ( aWidth / 2 ), 0.0 );
float innerRadius = max( aRadius - ( aWidth / 2 ), 0.0 );
float relWidth = innerRadius / outerRadius;
if( ( dot( aCoord, aCoord ) < 1.0 ) &&

View File

@ -591,7 +591,13 @@ void OPENGL_GAL::DrawArcSegment( const VECTOR2D& aCenterPoint, double aRadius, d
double aEndAngle, double aWidth )
{
if( aRadius <= 0 )
{
// Arcs of zero radius are a circle of aWidth diameter
if( aWidth > 0 )
DrawCircle( aCenterPoint, aWidth / 2.0 );
return;
}
// Swap the angles, if start angle is greater than end angle
SWAP( aStartAngle, >, aEndAngle );