Attempt #1 to fix LIB_SHAPE arc printing.

This commit is contained in:
Jeff Young 2021-11-16 22:55:53 +00:00
parent edc94f4d32
commit b4ac53d93d
3 changed files with 19 additions and 15 deletions

View File

@ -301,8 +301,12 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
switch( GetShape() )
{
case SHAPE_T::ARC:
GRFilledArc( nullptr, DC, c.x, c.y, -t2, -t1, GetRadius(), penWidth, color,
fillColor );
// 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 );
GRArc1( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, c.x, c.y, penWidth, color );
break;
case SHAPE_T::CIRCLE:

View File

@ -531,13 +531,6 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
}
void SCH_PAINTER::fillIfSelection( int aLayer )
{
if( aLayer == LAYER_SELECTION_SHADOWS && eeconfig()->m_Selection.fill_shapes )
m_gal->SetIsFill( true );
}
void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
{
if( !isUnitAndConversionShown( aShape ) )
@ -545,17 +538,26 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
if( setDeviceColors( aShape, aLayer ) )
{
fillIfSelection( aLayer );
if( aLayer == LAYER_SELECTION_SHADOWS && eeconfig()->m_Selection.fill_shapes )
{
// Consider a NAND gate. We have no idea which side of the arc is "inside" so
// we can't reliably fill.
if( aShape->GetShape() == SHAPE_T::ARC )
m_gal->SetIsFill( aShape->IsFilled() );
else
m_gal->SetIsFill( true );
}
switch( aShape->GetShape() )
{
case SHAPE_T::ARC:
{
int startAngle;
int endAngle;
int startAngle;
int endAngle;
aShape->CalcArcAngles( startAngle, endAngle );
TRANSFORM().MapAngles( &startAngle, &endAngle );
TRANSFORM().MapAngles( &startAngle, &endAngle );
m_gal->DrawArc( mapCoords( aShape->GetCenter() ), aShape->GetRadius(),
DECIDEG2RAD( startAngle ), DECIDEG2RAD( endAngle ) );
@ -579,7 +581,6 @@ void SCH_PAINTER::draw( const LIB_SHAPE *aShape, int aLayer )
for( const VECTOR2I& pt : poly.CPoints() )
mappedPts.push_back( mapCoords( (wxPoint) pt ) );
fillIfSelection( aLayer );
m_gal->DrawPolygon( mappedPts );
}
break;

View File

@ -184,7 +184,6 @@ private:
float getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows ) const;
bool setDeviceColors( const LIB_ITEM* aItem, int aLayer );
void fillIfSelection( int aLayer );
void triLine ( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c );
void strokeText( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle );