Corrected wxDC objects used by EDA_DRAW_PANEL_GAL & OPENGL_GAL.

This commit is contained in:
jean-pierre charras 2016-06-03 15:46:11 +02:00 committed by Maciej Suminski
parent dbef1d41c5
commit 3e2cae946c
3 changed files with 7 additions and 6 deletions

View File

@ -64,7 +64,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
SwitchBackend( aGalType ); SwitchBackend( aGalType );
SetBackgroundStyle( wxBG_STYLE_CUSTOM ); SetBackgroundStyle( wxBG_STYLE_CUSTOM );
// Scrollbars broken in GAL on OSX // Scrollbars broken in GAL on OSX
#ifdef __WXMAC__ #ifdef __WXMAC__
ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER ); ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
@ -153,6 +153,9 @@ void EDA_DRAW_PANEL_GAL::SetFocus()
void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
{ {
// This is required even though dc is not used otherwise.
wxPaintDC dc(this);
m_pendingRefresh = false; m_pendingRefresh = false;
if( m_drawing ) if( m_drawing )

View File

@ -40,6 +40,7 @@
#include <limits> #include <limits>
#include <boost/bind.hpp> #include <boost/bind.hpp>
using namespace KIGFX; using namespace KIGFX;
#include "bitmap_font_img.c" #include "bitmap_font_img.c"
@ -52,6 +53,7 @@ wxGLContext* OPENGL_GAL::glContext = NULL;
int OPENGL_GAL::instanceCounter = 0; int OPENGL_GAL::instanceCounter = 0;
bool OPENGL_GAL::isBitmapFontLoaded = false; bool OPENGL_GAL::isBitmapFontLoaded = false;
OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
wxEvtHandler* aPaintListener, const wxString& aName ) : wxEvtHandler* aPaintListener, const wxString& aName ) :
wxGLCanvas( aParent, wxID_ANY, (int*) glAttributes, wxDefaultPosition, wxDefaultSize, wxGLCanvas( aParent, wxID_ANY, (int*) glAttributes, wxDefaultPosition, wxDefaultSize,
@ -164,7 +166,6 @@ void OPENGL_GAL::BeginDrawing()
#endif /* __WXDEBUG__ */ #endif /* __WXDEBUG__ */
SetCurrent( *glContext ); SetCurrent( *glContext );
clientDC = new wxClientDC( this );
#ifdef RETINA_OPENGL_PATCH #ifdef RETINA_OPENGL_PATCH
const float scaleFactor = GetBackingScaleFactor(); const float scaleFactor = GetBackingScaleFactor();
@ -300,8 +301,6 @@ void OPENGL_GAL::EndDrawing()
SwapBuffers(); SwapBuffers();
delete clientDC;
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
prof_end( &totalRealTime ); prof_end( &totalRealTime );
wxLogTrace( "GAL_PROFILE", wxT( "OPENGL_GAL::EndDrawing(): %.1f ms" ), totalRealTime.msecs() ); wxLogTrace( "GAL_PROFILE", wxT( "OPENGL_GAL::EndDrawing(): %.1f ms" ), totalRealTime.msecs() );

View File

@ -52,6 +52,7 @@ namespace KIGFX
{ {
class SHADER; class SHADER;
/** /**
* @brief Class OpenGL_GAL is the OpenGL implementation of the Graphics Abstraction Layer. * @brief Class OpenGL_GAL is the OpenGL implementation of the Graphics Abstraction Layer.
* *
@ -62,7 +63,6 @@ class SHADER;
class OPENGL_GAL : public GAL, public wxGLCanvas class OPENGL_GAL : public GAL, public wxGLCanvas
{ {
public: public:
/** /**
* @brief Constructor OPENGL_GAL * @brief Constructor OPENGL_GAL
* *
@ -273,7 +273,6 @@ private:
static const int CIRCLE_POINTS = 64; ///< The number of points for circle approximation static const int CIRCLE_POINTS = 64; ///< The number of points for circle approximation
static const int CURVE_POINTS = 32; ///< The number of points for curve approximation static const int CURVE_POINTS = 32; ///< The number of points for curve approximation
wxClientDC* clientDC; ///< Drawing context
static wxGLContext* glContext; ///< OpenGL context of wxWidgets static wxGLContext* glContext; ///< OpenGL context of wxWidgets
wxEvtHandler* mouseListener; wxEvtHandler* mouseListener;
wxEvtHandler* paintListener; wxEvtHandler* paintListener;