From 876bf75d8971831edf6591dbc0a50180cecb1664 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 18 Jun 2013 16:19:30 +0200 Subject: [PATCH] Added GAL_TYPE_NONE as an indicator of GAL uninitialized state. --- common/drawpanel_gal.cpp | 13 ++++++++----- include/class_drawpanel_gal.h | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/common/drawpanel_gal.cpp b/common/drawpanel_gal.cpp index ea6e31ed7d..cb338db085 100644 --- a/common/drawpanel_gal.cpp +++ b/common/drawpanel_gal.cpp @@ -51,9 +51,10 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin GalType aGalType ) : wxWindow( aParentWindow, aWindowId, aPosition, aSize ) { - m_gal = NULL; - m_view = NULL; - m_painter = NULL; + m_gal = NULL; + m_currentGal = GAL_TYPE_NONE; + m_view = NULL; + m_painter = NULL; wxStandardPaths paths; wxFileName executableFile( paths.GetExecutablePath() ); @@ -158,8 +159,7 @@ void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType, bool aUseShaders ) if( aGalType == m_currentGal && aUseShaders == m_useShaders && m_gal != NULL ) return; - if( m_gal ) - delete m_gal; + delete m_gal; switch( aGalType ) { @@ -171,6 +171,9 @@ void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType, bool aUseShaders ) case GAL_TYPE_CAIRO: m_gal = new KiGfx::CAIRO_GAL( this, this, this ); break; + + case GAL_TYPE_NONE: + return; } m_gal->SetWorldUnitLength( 1.0 / METRIC_UNIT_LENGTH * 2.54 ); // 1 inch in nanometers diff --git a/include/class_drawpanel_gal.h b/include/class_drawpanel_gal.h index 62f98c5767..d0b94f08e4 100644 --- a/include/class_drawpanel_gal.h +++ b/include/class_drawpanel_gal.h @@ -50,6 +50,7 @@ class EDA_DRAW_PANEL_GAL : public wxWindow { public: enum GalType { + GAL_TYPE_NONE, ///< Not used GAL_TYPE_OPENGL, ///< OpenGL implementation GAL_TYPE_CAIRO, ///< Cairo implementation };