minor enhancement in code

This commit is contained in:
jean-pierre charras 2017-10-26 10:55:01 +02:00
parent 48ed0dcda2
commit d2d1237506
1 changed files with 15 additions and 13 deletions

View File

@ -788,27 +788,29 @@ void GRClosedPoly( EDA_RECT* ClipBox, wxDC* DC, int n, wxPoint Points[],
}
static bool ClipCircle( EDA_RECT* ClipBox, int xc, int yc, int r, int width )
static bool clipCircle( EDA_RECT* aClipBox, int xc, int yc, int r, int aWidth )
{
/* Clip circles off screen. */
if( ClipBox )
// Clip circles that are outside the ClipBox.
if( aClipBox )
{
int x0, y0, xm, ym;
x0 = ClipBox->GetX();
y0 = ClipBox->GetY();
xm = ClipBox->GetRight();
ym = ClipBox->GetBottom();
x0 = aClipBox->GetX();
y0 = aClipBox->GetY();
xm = aClipBox->GetRight();
ym = aClipBox->GetBottom();
if( xc < ( x0 - r - width ) )
r += aWidth;
if( xc < ( x0 - r ) )
return true;
if( yc < ( y0 - r - width ) )
if( yc < ( y0 - r ) )
return true;
if( xc > ( r + xm + width ) )
if( xc > ( r + xm ) )
return true;
if( yc > ( r + ym + width ) )
if( yc > ( r + ym ) )
return true;
}
@ -818,7 +820,7 @@ static bool ClipCircle( EDA_RECT* ClipBox, int xc, int yc, int r, int width )
void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, int r, int width, COLOR4D Color )
{
if( ClipCircle( ClipBox, xc, yc, r, width ) )
if( clipCircle( ClipBox, xc, yc, r, width ) )
return;
GRSetBrush( DC, Color, NOT_FILLED );
@ -842,7 +844,7 @@ void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWi
void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r,
int width, COLOR4D Color, COLOR4D BgColor )
{
if( ClipCircle( ClipBox, x, y, r, width ) )
if( clipCircle( ClipBox, x, y, r, width ) )
return;
GRSetBrush( DC, BgColor, FILLED );