Eeschema plot: fix incorrect background color used to generate dimmed color.

This is for a LIB_TEXT and a SCH_FIELD.
Fixes #12709
https://gitlab.com/kicad/code/kicad/issues/12709
This commit is contained in:
jean-pierre charras 2022-10-22 17:02:45 +02:00
parent 38c863c3f4
commit 75a3209e55
2 changed files with 4 additions and 7 deletions

View File

@ -282,14 +282,14 @@ void LIB_TEXT::Plot( PLOTTER* plotter, bool aBackground, const VECTOR2I& offset,
int t1 = ( aTransform.x1 != 0 ) ^ ( GetTextAngle() != ANGLE_HORIZONTAL );
VECTOR2I pos = aTransform.TransformCoordinate( txtpos ) + offset;
COLOR4D color = GetTextColor();
COLOR4D bg = settings->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
COLOR4D bg = settings->GetBackgroundColor();
if( !plotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
color = settings->GetLayerColor( LAYER_DEVICE );
if( !IsVisible() )
bg = settings->GetLayerColor( LAYER_HIDDEN );
else if( !plotter->GetColorMode() )
else if( bg == COLOR4D::UNSPECIFIED || !plotter->GetColorMode() )
bg = COLOR4D::WHITE;
if( aDimmed )

View File

@ -965,14 +965,11 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter, bool aBackground ) const
COLOR4D color = settings->GetLayerColor( GetLayer() );
int penWidth = GetEffectiveTextPenWidth( settings->GetDefaultPenWidth() );
COLOR4D bg = settings->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
COLOR4D bg = settings->GetBackgroundColor();;
if( !aPlotter->GetColorMode() )
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
if( SCH_SYMBOL* parent = dyn_cast<SCH_SYMBOL*>( m_parent ); parent && parent->GetDNP() )
color = color.Mix( bg, 0.5f );
if( aPlotter->GetColorMode() && GetTextColor() != COLOR4D::UNSPECIFIED )
color = GetTextColor();