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. */ // Clip circles that are outside the ClipBox.
if( ClipBox ) if( aClipBox )
{ {
int x0, y0, xm, ym; int x0, y0, xm, ym;
x0 = ClipBox->GetX(); x0 = aClipBox->GetX();
y0 = ClipBox->GetY(); y0 = aClipBox->GetY();
xm = ClipBox->GetRight(); xm = aClipBox->GetRight();
ym = ClipBox->GetBottom(); ym = aClipBox->GetBottom();
if( xc < ( x0 - r - width ) ) r += aWidth;
if( xc < ( x0 - r ) )
return true; return true;
if( yc < ( y0 - r - width ) ) if( yc < ( y0 - r ) )
return true; return true;
if( xc > ( r + xm + width ) ) if( xc > ( r + xm ) )
return true; return true;
if( yc > ( r + ym + width ) ) if( yc > ( r + ym ) )
return true; 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 ) 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; return;
GRSetBrush( DC, Color, NOT_FILLED ); 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, void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r,
int width, COLOR4D Color, COLOR4D BgColor ) int width, COLOR4D Color, COLOR4D BgColor )
{ {
if( ClipCircle( ClipBox, x, y, r, width ) ) if( clipCircle( ClipBox, x, y, r, width ) )
return; return;
GRSetBrush( DC, BgColor, FILLED ); GRSetBrush( DC, BgColor, FILLED );