From 4eadf2ef478a450ae2d840080245fd42aebc645c Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 16 Apr 2013 11:43:13 +0200 Subject: [PATCH] Removed flickering in Cairo-based rendering backend. --- common/drawpanel_gal.cpp | 23 ++++++++++++----------- include/class_drawpanel_gal.h | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/common/drawpanel_gal.cpp b/common/drawpanel_gal.cpp index 74d95866a8..480713012c 100644 --- a/common/drawpanel_gal.cpp +++ b/common/drawpanel_gal.cpp @@ -78,12 +78,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin m_viewControls = new KiGfx::WX_VIEW_CONTROLS( m_view, this ); -#if wxCHECK_VERSION( 2, 9, 0 ) Connect( KiGfx::EVT_GAL_REDRAW, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this ); -#elif wxCHECK_VERSION( 2, 8, 0 ) - // FIXME Cairo needs this to be uncommented to remove blinking on refreshing - Connect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this ); -#endif Connect( wxEVT_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), NULL, this ); } @@ -105,6 +100,18 @@ EDA_DRAW_PANEL_GAL::~EDA_DRAW_PANEL_GAL() void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& aEvent ) +{ + Refresh(); +} + + +void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent ) +{ + m_gal->ResizeScreen( aEvent.GetSize().x, aEvent.GetSize().y ); +} + + +void EDA_DRAW_PANEL_GAL::Refresh( bool eraseBackground, const wxRect* rect ) { m_gal->BeginDrawing(); m_gal->SetBackgroundColor( KiGfx::COLOR4D( 0, 0, 0, 1.0 ) ); @@ -122,12 +129,6 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& aEvent ) } -void EDA_DRAW_PANEL_GAL::onSize( wxSizeEvent& aEvent ) -{ - m_gal->ResizeScreen( aEvent.GetSize().x, aEvent.GetSize().y ); -} - - void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType, bool aUseShaders ) { if( m_gal ) diff --git a/include/class_drawpanel_gal.h b/include/class_drawpanel_gal.h index e0b88da421..acde693b9a 100644 --- a/include/class_drawpanel_gal.h +++ b/include/class_drawpanel_gal.h @@ -75,7 +75,7 @@ public: void SetView( KiGfx::VIEW* aView ) { m_view = aView; } KiGfx::VIEW* GetView() const { return m_view; } - //void Refresh( bool eraseBackground = true, const wxRect* rect = NULL ); + virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL ); protected: void onPaint( wxPaintEvent& aEvent );