← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] GerbView performance optimizations

 

And one final performance patch for now

On Sun, Feb 25, 2018 at 6:56 PM, Jon Evans <jon@xxxxxxxxxxxxx> wrote:

> One more performance optimization attached
>
> Clemens -- are you talking to me directly?  For most of my smaller fixes I
> do not push them to anywhere public before they get merged.  Wayne has been
> merging my changes pretty quickly though, so the nightly builds are pretty
> close to real-time.
>
> On Sun, Feb 25, 2018 at 6:49 PM, Clemens Koller <cko@xxxxxxxxx> wrote:
>
>> What is the quickest way to git pull your changes when I want to follow
>> you in real-time?
>>
>> git.launchpad.net/kicad ?
>>
>> On 2018-02-26 00:39, Wayne Stambaugh wrote:
>> > Patches merged.  Thanks!
>> >
>> > On 02/25/2018 03:14 PM, Jon Evans wrote:
>> >> These patches improves redraw performance when toggling sketch/filled
>> >> draw modes.
>> >>
>> >> On Linux at least, the difference is quite noticeable on complicated
>> >> Gerber files.
>> >>
>> >> -Jon
>> >>
>> >>
>> >> _______________________________________________
>> >> 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
>> >>
>> >
>> > _______________________________________________
>> > 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
>> >
>>
>> _______________________________________________
>> 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 c1c061f701ca9c6912dcf2f33d50b677840fd09d Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Sun, 25 Feb 2018 19:08:27 -0500
Subject: [PATCH] Remove more unnecessary calls to RecacheAllItems

---
 gerbview/dialogs/gerbview_dialog_display_options_frame.cpp | 1 -
 gerbview/events_called_functions.cpp                       | 2 +-
 gerbview/gerbview_layer_widget.cpp                         | 6 ++----
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
index 70da7469e..4754c9c6e 100644
--- a/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
+++ b/gerbview/dialogs/gerbview_dialog_display_options_frame.cpp
@@ -190,7 +190,6 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
     auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( view->GetPainter() );
     auto settings = static_cast<KIGFX::GERBVIEW_RENDER_SETTINGS*>( painter->GetSettings() );
     settings->LoadDisplayOptions( displayOptions );
-    view->RecacheAllItems();
     view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
 
     m_Parent->GetCanvas()->Refresh();
diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp
index 1cfb59463..fac8e99b7 100644
--- a/gerbview/events_called_functions.cpp
+++ b/gerbview/events_called_functions.cpp
@@ -324,7 +324,7 @@ void GERBVIEW_FRAME::OnSelectHighlightChoice( wxCommandEvent& event )
 
         }
 
-        GetGalCanvas()->GetView()->RecacheAllItems();
+        GetGalCanvas()->GetView()->UpdateAllItems( KIGFX::COLOR );
         GetGalCanvas()->Refresh();
     }
     else
diff --git a/gerbview/gerbview_layer_widget.cpp b/gerbview/gerbview_layer_widget.cpp
index 7373a8250..e5e037785 100644
--- a/gerbview/gerbview_layer_widget.cpp
+++ b/gerbview/gerbview_layer_widget.cpp
@@ -336,9 +336,9 @@ void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
         auto view = galCanvas->GetView();
         view->GetPainter()->GetSettings()->ImportLegacyColors( myframe->m_colorsSettings );
         view->UpdateLayerColor( aId );
-        // TODO(JE) Why are the below two lines needed? Not needed in pcbnew
+
         view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
-        view->RecacheAllItems();
+        view->UpdateAllItems( KIGFX::COLOR );
     }
 
     if( galCanvas && myframe->IsGalCanvasActive() )
@@ -359,8 +359,6 @@ void GERBER_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
         {
             galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() );
             galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
-            // TODO(JE) Why is the below line needed? Not needed in pcbnew
-            galCanvas->GetView()->RecacheAllItems();
         }
         else
             galCanvas->GetView()->SetLayerVisible( aId, isEnabled );
-- 
2.14.1


References