Don't allow drawing to a zero-height or zero-width GAL canvas.
Fixes: lp:1793913 * https://bugs.launchpad.net/kicad/+bug/1793913
This commit is contained in:
parent
85ef058458
commit
0309228276
|
@ -147,6 +147,12 @@ void EDA_DRAW_PANEL_GAL::SetFocus()
|
||||||
|
|
||||||
void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
|
void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
|
||||||
{
|
{
|
||||||
|
m_viewControls->UpdateScrollbars();
|
||||||
|
|
||||||
|
// Drawing to a zero-width or zero-height GAL is fraught with peril.
|
||||||
|
if( GetClientRect().IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
m_pendingRefresh = false;
|
m_pendingRefresh = false;
|
||||||
|
|
||||||
if( m_drawing )
|
if( m_drawing )
|
||||||
|
@ -161,8 +167,6 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
|
||||||
m_drawing = true;
|
m_drawing = true;
|
||||||
KIGFX::RENDER_SETTINGS* settings = static_cast<KIGFX::RENDER_SETTINGS*>( m_painter->GetSettings() );
|
KIGFX::RENDER_SETTINGS* settings = static_cast<KIGFX::RENDER_SETTINGS*>( m_painter->GetSettings() );
|
||||||
|
|
||||||
m_viewControls->UpdateScrollbars();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_view->UpdateItems();
|
m_view->UpdateItems();
|
||||||
|
|
|
@ -91,6 +91,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GL_BITMAP_CACHE::~GL_BITMAP_CACHE()
|
GL_BITMAP_CACHE::~GL_BITMAP_CACHE()
|
||||||
{
|
{
|
||||||
for ( auto b = m_bitmaps.begin(); b != m_bitmaps.end(); ++b )
|
for ( auto b = m_bitmaps.begin(); b != m_bitmaps.end(); ++b )
|
||||||
|
@ -99,6 +100,7 @@ GL_BITMAP_CACHE::~GL_BITMAP_CACHE()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GLuint GL_BITMAP_CACHE::RequestBitmap( const BITMAP_BASE* aBitmap )
|
GLuint GL_BITMAP_CACHE::RequestBitmap( const BITMAP_BASE* aBitmap )
|
||||||
{
|
{
|
||||||
auto it = m_bitmaps.find( aBitmap) ;
|
auto it = m_bitmaps.find( aBitmap) ;
|
||||||
|
@ -320,7 +322,7 @@ bool OPENGL_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
|
||||||
|
|
||||||
void OPENGL_GAL::BeginDrawing()
|
void OPENGL_GAL::BeginDrawing()
|
||||||
{
|
{
|
||||||
if( !IsShownOnScreen() )
|
if( !IsShownOnScreen() || GetClientRect().IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef __WXDEBUG__
|
#ifdef __WXDEBUG__
|
||||||
|
@ -491,7 +493,7 @@ void OPENGL_GAL::EndDrawing()
|
||||||
|
|
||||||
void OPENGL_GAL::BeginUpdate()
|
void OPENGL_GAL::BeginUpdate()
|
||||||
{
|
{
|
||||||
if( !IsShownOnScreen() )
|
if( !IsShownOnScreen() || GetClientRect().IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !isInitialized )
|
if( !isInitialized )
|
||||||
|
|
|
@ -88,8 +88,9 @@ public:
|
||||||
virtual ~CAIRO_GAL();
|
virtual ~CAIRO_GAL();
|
||||||
|
|
||||||
///> @copydoc GAL::IsVisible()
|
///> @copydoc GAL::IsVisible()
|
||||||
bool IsVisible() const override {
|
bool IsVisible() const override
|
||||||
return IsShownOnScreen();
|
{
|
||||||
|
return IsShownOnScreen() && !GetClientRect().IsEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------
|
// ---------------
|
||||||
|
|
|
@ -90,13 +90,13 @@ public:
|
||||||
virtual bool IsInitialized() const override
|
virtual bool IsInitialized() const override
|
||||||
{
|
{
|
||||||
// is*Initialized flags, but it is enough for OpenGL to show up
|
// is*Initialized flags, but it is enough for OpenGL to show up
|
||||||
return IsShownOnScreen();
|
return IsShownOnScreen() && !GetClientRect().IsEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
///> @copydoc GAL::IsVisible()
|
///> @copydoc GAL::IsVisible()
|
||||||
bool IsVisible() const override
|
bool IsVisible() const override
|
||||||
{
|
{
|
||||||
return IsShownOnScreen();
|
return IsShownOnScreen() && !GetClientRect().IsEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------
|
// ---------------
|
||||||
|
|
Loading…
Reference in New Issue