← Back to team overview

kicad-developers team mailing list archive

[PATCH 2/2] Corruption when moving pins in library editor

 

Every time I move a pin in the library editor I end up with a different
colored artifact of the pin text in the original position. This happens
because we clear the old text by XOR'ing with the pin color, not the pin
text color.

The following patch looks up the pin name and pin number layers for
the colors instead of using the pin color. It also uses UNSPECIFIED_COLOR
in a few places where it was open coded.

Index: b/eeschema/lib_pin.cpp
===================================================================
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -826,13 +826,13 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANE
     wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
 
     /* Drawing from the pin and the special symbol combination */
-    DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor );
+    DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, UNSPECIFIED_COLOR );
 
     if( DrawPinText )
     {
         DrawPinTexts( aPanel, aDC, pos1, orient, Entry->GetPinNameOffset(),
                       Entry->ShowPinNumbers(), Entry->ShowPinNames(),
-                      aColor, aDrawMode );
+                      UNSPECIFIED_COLOR, aDrawMode );
     }
 
     /* Set to one (1) to draw bounding box around pin to validate bounding
@@ -1087,12 +1087,8 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PAN
 
     GRSetDrawMode( DC, DrawMode );
 
-    /* Get the num and name colors */
-    if( (Color < 0) && IsSelected() )
-        Color = GetItemSelectedColor();
-
-    NameColor = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color );
-    NumColor  = (EDA_COLOR_T) ( Color == -1 ? ReturnLayerColor( LAYER_PINNUM ) : Color );
+    NameColor = (EDA_COLOR_T) ( Color == UNSPECIFIED_COLOR ? ReturnLayerColor( LAYER_PINNAM ) : Color );
+    NumColor  = (EDA_COLOR_T) ( Color == UNSPECIFIED_COLOR ? ReturnLayerColor( LAYER_PINNUM ) : Color );
 
     /* Create the pin num string */
     ReturnPinStringNum( StringPinNum );


Follow ups

References