GAL: Fallback to CAIRO on OpenGL error

When the error switching to OpenGL is triggered by the requested switch,
we want to fallback to the cairo GAL renderer instead of the
GAL_TYPE_NONE, which defaults to legacy.

Fixes: lp:1799017
* https://bugs.launchpad.net/kicad/+bug/1799017
This commit is contained in:
Seth Hillbrand 2018-11-23 19:50:09 -08:00
parent 647fa6547d
commit 327942affb
1 changed files with 12 additions and 4 deletions

View File

@ -221,7 +221,7 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
} }
else else
{ {
SwitchBackend( GAL_TYPE_CAIRO ); SwitchBackend( GAL_FALLBACK );
} }
DisplayError( m_parent, wxString( err.what() ) ); DisplayError( m_parent, wxString( err.what() ) );
@ -375,9 +375,17 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GAL_TYPE aGalType )
switch( aGalType ) switch( aGalType )
{ {
case GAL_TYPE_OPENGL: case GAL_TYPE_OPENGL:
new_gal = new KIGFX::OPENGL_GAL( m_options, this, this, this ); try
break; {
new_gal = new KIGFX::OPENGL_GAL( m_options, this, this, this );
break;
}
catch( std::runtime_error& err )
{
aGalType = GAL_TYPE_CAIRO;
DisplayError( m_parent, wxString( err.what() ) );
}
//Fallthrough
case GAL_TYPE_CAIRO: case GAL_TYPE_CAIRO:
new_gal = new KIGFX::CAIRO_GAL( m_options, this, this, this ); new_gal = new KIGFX::CAIRO_GAL( m_options, this, this, this );
break; break;