Browse Source

Fix printing of LIB_SHAPE arcs.

6.0.7
Jeff Young 4 years ago
parent
commit
7760d3275d
  1. 32
      common/gr_basic.cpp
  2. 6
      eeschema/lib_shape.cpp
  3. 2
      include/gr_basic.h

32
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 )
{

6
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:

2
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 );

Loading…
Cancel
Save