Removed flickering in Cairo-based rendering backend.

This commit is contained in:
Maciej Suminski 2013-04-16 11:43:13 +02:00
parent bee0d69289
commit 4eadf2ef47
2 changed files with 13 additions and 12 deletions

View File

@ -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 )

View File

@ -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 );