kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #33688
[PATCH] Respect item polarity when redrawing cached gerber view items
Fixes https://bugs.launchpad.net/kicad/+bug/1746825
-Jon
From 2e03f0640f4ddabac8959b39b68af319b1e2b12d Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Sun, 4 Feb 2018 15:38:53 -0500
Subject: [PATCH] Respect item polarity when redrawing cached gerber view items
Fixes: lp:1746825
* https://bugs.launchpad.net/kicad/+bug/1746825
---
gerbview/gerbview_painter.cpp | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/gerbview/gerbview_painter.cpp b/gerbview/gerbview_painter.cpp
index 95ccf5efc..486c90a66 100644
--- a/gerbview/gerbview_painter.cpp
+++ b/gerbview/gerbview_painter.cpp
@@ -92,6 +92,7 @@ void GERBVIEW_RENDER_SETTINGS::LoadDisplayOptions( const GBR_DISPLAY_OPTIONS* aO
const COLOR4D& GERBVIEW_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
{
const GERBER_DRAW_ITEM* item = static_cast<const GERBER_DRAW_ITEM*>( aItem );
+ static const COLOR4D transparent = COLOR4D( 0, 0, 0, 0 );
// All DCODE layers stored under a single color setting
if( IsDCodeLayer( aLayer ) )
@@ -101,6 +102,14 @@ const COLOR4D& GERBVIEW_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int a
{
if( item->IsSelected() )
return m_layerColorsSel[aLayer];
+
+ if( item->GetLayerPolarity() )
+ {
+ if( m_showNegativeItems )
+ return m_layerColors[LAYER_NEGATIVE_OBJECTS];
+ else
+ return transparent;
+ }
}
if( !m_netHighlightString.IsEmpty() && item &&
@@ -219,14 +228,7 @@ void GERBVIEW_PAINTER::draw( /*const*/ GERBER_DRAW_ITEM* aItem, int aLayer )
if( aItem->IsBrightened() )
color = COLOR4D( 0.0, 1.0, 0.0, 0.75 );
- if( isNegative )
- {
- if( m_gerbviewSettings.m_showNegativeItems )
- color = m_gerbviewSettings.GetLayerColor( LAYER_NEGATIVE_OBJECTS );
- else
- color = COLOR4D( 0, 0, 0, 0 );
- }
- else if( m_gerbviewSettings.m_diffMode )
+ if( m_gerbviewSettings.m_diffMode )
{
color.a = 0.75;
}
--
2.14.1
Follow ups