diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index ca177d31a3..d0f368d408 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -638,6 +638,38 @@ void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aStart, const wxPoint } +void GRFilledArc1( EDA_RECT* ClipBox, wxDC* DC, const wxPoint& aStart, const wxPoint& aEnd, + const wxPoint& aCenter, int width, const COLOR4D& Color, const COLOR4D& BgColor ) +{ + /* Clip arcs off screen. */ + if( ClipBox ) + { + int x0, y0, xm, ym, r; + x0 = ClipBox->GetX(); + y0 = ClipBox->GetY(); + xm = ClipBox->GetRight(); + ym = ClipBox->GetBottom(); + r = KiROUND( Distance( aStart.x, aStart.y, aCenter.x, aCenter.y ) ); + + if( aCenter.x < ( x0 - r ) ) + return; + + if( aCenter.y < ( y0 - r ) ) + return; + + if( aCenter.x > ( r + xm ) ) + return; + + if( aCenter.y > ( r + ym ) ) + return; + } + + GRSetBrush( DC, BgColor, FILLED ); + GRSetColorPen( DC, Color, width ); + DC->DrawArc( aStart.x, aStart.y, aEnd.x, aEnd.y, aCenter.x, aCenter.y ); +} + + void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, double EndAngle, int r, int width, const COLOR4D& Color, const COLOR4D& BgColor ) { diff --git a/eeschema/lib_shape.cpp b/eeschema/lib_shape.cpp index dafc03d6fc..df0eb2f55f 100644 --- a/eeschema/lib_shape.cpp +++ b/eeschema/lib_shape.cpp @@ -270,7 +270,7 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, switch( GetShape() ) { case SHAPE_T::ARC: - GRArc1( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, c.x, c.y, penWidth, color ); + GRArc1( nullptr, DC, pt1, pt2, c, penWidth, color ); break; case SHAPE_T::CIRCLE: @@ -304,9 +304,9 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, // If we stroke in GRFilledArc it will stroke the two radials too, so we have to // fill and stroke separately - GRFilledArc( nullptr, DC, c.x, c.y, -t2, -t1, GetRadius(), 0, fillColor, fillColor ); + GRFilledArc1( nullptr, DC, pt1, pt2, c, penWidth, fillColor, fillColor ); - GRArc1( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, c.x, c.y, penWidth, color ); + GRArc1( nullptr, DC, pt1, pt2, c, penWidth, color ); break; case SHAPE_T::CIRCLE: diff --git a/include/gr_basic.h b/include/gr_basic.h index 351ad26649..df7fcedad1 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -190,6 +190,8 @@ void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, dou int r, const COLOR4D& Color, const COLOR4D& BgColor ); void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, double EndAngle, int r, int width, const COLOR4D& Color, const COLOR4D& BgColor ); +void GRFilledArc1( EDA_RECT* ClipBox, wxDC* DC, const wxPoint& aStart, const wxPoint& aEnd, + const wxPoint& aCenter, int width, const COLOR4D& Color, const COLOR4D& BgColor ); void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, const COLOR4D& Color );