Move zone borders back to their "host" layer.

Zone borders shouldn't be affected by zone-opacity control; we always
draw them in full layer opacity.

Fixes https://gitlab.com/kicad/code/kicad/issues/12438

(cherry picked from commit 25f06eed8c)
This commit is contained in:
Jeff Young 2022-11-05 12:00:56 +00:00
parent ede21ed6ae
commit 2f47857abc
4 changed files with 44 additions and 34 deletions

View File

@ -148,7 +148,7 @@ void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
{
int layer = layers[i];
if( IsZoneLayer( layer ) )
if( IsZoneFillLayer( layer ) )
layer = layer - LAYER_ZONE_START;
bool draw = aView->IsLayerVisible( layer );

View File

@ -980,7 +980,7 @@ inline bool IsNetnameLayer( LAYER_NUM aLayer )
}
inline bool IsZoneLayer( LAYER_NUM aLayer )
inline bool IsZoneFillLayer( int aLayer )
{
return aLayer >= LAYER_ZONE_START && aLayer <= LAYER_ZONE_END;
}

View File

@ -262,7 +262,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
// Zones should pull from the copper layer
if( item && ( item->Type() == PCB_ZONE_T || item->Type() == PCB_FP_ZONE_T ) )
{
if( IsZoneLayer( aLayer ) )
if( IsZoneFillLayer( aLayer ) )
aLayer = aLayer - LAYER_ZONE_START;
}
@ -1742,8 +1742,12 @@ void PCB_PAINTER::draw( const ZONE* aZone, int aLayer )
* The color for the zone comes from the associated copper layer ( aLayer - LAYER_ZONE_START )
* and the visibility comes from the combination of that copper layer and LAYER_ZONES
*/
wxASSERT( IsZoneLayer( aLayer ) );
PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( aLayer - LAYER_ZONE_START );
PCB_LAYER_ID layer;
if( IsZoneFillLayer( aLayer ) )
layer = ToLAYER_ID( aLayer - LAYER_ZONE_START );
else
layer = ToLAYER_ID( aLayer );
if( !aZone->IsOnLayer( layer ) )
return;
@ -1753,9 +1757,11 @@ void PCB_PAINTER::draw( const ZONE* aZone, int aLayer )
ZONE_DISPLAY_MODE displayMode = m_pcbSettings.m_zoneDisplayMode;
// Draw the outline
if( !IsZoneFillLayer( aLayer ) )
{
const SHAPE_POLY_SET* outline = aZone->Outline();
if( m_pcbSettings.m_zoneOutlines && outline && outline->OutlineCount() > 0 )
if( !m_pcbSettings.m_isPrinting && outline && outline->OutlineCount() > 0 )
{
m_gal->SetStrokeColor( color.a > 0.0 ? color.WithAlpha( 1.0 ) : color );
m_gal->SetIsFill( false );
@ -1783,11 +1789,13 @@ void PCB_PAINTER::draw( const ZONE* aZone, int aLayer )
for( const SEG& hatchLine : aZone->GetHatchLines() )
m_gal->DrawLine( hatchLine.A, hatchLine.B );
}
}
// Draw the filling
if( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED
if( IsZoneFillLayer( aLayer )
&& ( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED
|| displayMode == ZONE_DISPLAY_MODE::SHOW_FRACTURE_BORDERS
|| displayMode == ZONE_DISPLAY_MODE::SHOW_TRIANGULATION )
|| displayMode == ZONE_DISPLAY_MODE::SHOW_TRIANGULATION ) )
{
const SHAPE_POLY_SET& polySet = aZone->GetFilledPolysList( layer );

View File

@ -309,12 +309,14 @@ LSET ZONE::GetLayerSet() const
void ZONE::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 0;
LSEQ layers = m_layerSet.Seq();
for( unsigned int idx = 0; idx < layers.size(); idx++ )
aLayers[idx] = LAYER_ZONE_START + layers[idx];
aCount = layers.size();
for( PCB_LAYER_ID layer : m_layerSet.Seq() )
{
aLayers[ aCount++ ] = layer; // For outline (always full opacity)
aLayers[ aCount++ ] = layer + LAYER_ZONE_START; // For fill (obeys global zone opacity)
}
}