From 3f161965cdaeb2fddcbeeffd8bb584cc1a6b2108 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 9 Jan 2020 14:43:46 +0100 Subject: [PATCH] Eeschema: Draw selected global labels:fix incorrect text drawing. Happens only on Cairo. Was due to the fact on cairo the shape area was deleted after the shadow text was drawn, and only the second text was seen. Fixes #3745 https://gitlab.com/kicad/code/kicad/issues/3745 --- eeschema/sch_painter.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index cf491cb9d7..b7c9470771 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -1464,7 +1464,15 @@ void SCH_PAINTER::draw( SCH_GLOBALLABEL *aLabel, int aLayer ) for( auto p : pts ) pts2.emplace_back( VECTOR2D( p.x, p.y ) ); - m_gal->SetIsFill( true ); + // the text is drawn inside the graphic shape. + // On Cairo the graphic shape is filled by the background + // before drawing the text (). + // However if the text is selected, it is draw twice: + // first, on LAYER_SELECTION_SHADOWS + // second, on the text layer. + // the second must not erase the first drawing. + bool fillBg = ( aLayer == LAYER_SELECTION_SHADOWS ) || !aLabel->IsSelected(); + m_gal->SetIsFill( fillBg ); m_gal->SetFillColor( m_schSettings.GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) ); m_gal->SetIsStroke( true ); m_gal->SetLineWidth( getTextThickness( aLabel, drawingShadows ) );