← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Fix DRC marker drawing in Cairo and color in hover state

 

Oops, attached!

On Wed, Nov 29, 2017 at 4:27 AM, Nick Østergaard <oe.nick@xxxxxxxxx> wrote:

> No patch is attached to this email.
>
> Den 29. nov. 2017 4.00 AM skrev "Jon Evans" <jon@xxxxxxxxxxxxx>:
>
>> Hi all,
>>
>> I started working on [1] but haven't solved it yet.  I did fix a few
>> minor bugs discovered along the way, in the attached patch.  The polygon
>> wasn't closed, so weird draw artifacts appear in Cairo, and the color was
>> not being taken from the color settings class, so the markers were not
>> being brightened when hovering on them in the selection disambiguation menu.
>>
>> -Jon
>>
>> [1] https://bugs.launchpad.net/kicad/+bug/1542420
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
From f52c1d8b264a6bc0b183625c820c9b80ffd8d613 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Tue, 28 Nov 2017 21:57:28 -0500
Subject: [PATCH] Fix DRC marker drawing in Cairo and color in hover state

---
 pcbnew/pcb_painter.cpp | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp
index 8f56d1baa..0d969204b 100644
--- a/pcbnew/pcb_painter.cpp
+++ b/pcbnew/pcb_painter.cpp
@@ -1249,21 +1249,15 @@ void PCB_PAINTER::draw( const MARKER_PCB* aMarker )
         VECTOR2D(  9 * scale,   9 * scale ),
         VECTOR2D(  8 * scale,  13 * scale ),
         VECTOR2D(  3 * scale,   4 * scale ),
-        VECTOR2D(  1 * scale,   8 * scale )
+        VECTOR2D(  1 * scale,   8 * scale ),
+        VECTOR2D(  0 * scale,   0 * scale )
     };
 
+    auto strokeColor = m_pcbSettings.GetColor( aMarker, LAYER_DRC );
+
     m_gal->Save();
     m_gal->Translate( aMarker->GetPosition() );
-
-    if( aMarker->IsSelected() )
-    {
-        m_gal->SetFillColor( COLOR4D( 1.0, 0.5, 0.5, 1.0 ) );
-    }
-    else
-    {
-        m_gal->SetFillColor( COLOR4D( 1.0, 0.0, 0.0, 1.0 ) );
-    }
-
+    m_gal->SetFillColor( strokeColor );
     m_gal->SetIsFill( true );
     m_gal->SetIsStroke( false );
     m_gal->DrawPolygon( arrow, sizeof( arrow ) / sizeof( VECTOR2D ) );
-- 
2.14.1


Follow ups

References