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 ) )
|
||||
{
|
||||
m_viewControls->UpdateScrollbars();
|
||||
|
||||
// Drawing to a zero-width or zero-height GAL is fraught with peril.
|
||||
if( GetClientRect().IsEmpty() )
|
||||
return;
|
||||
|
||||
m_pendingRefresh = false;
|
||||
|
||||
if( m_drawing )
|
||||
|
@ -161,8 +167,6 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
|
|||
m_drawing = true;
|
||||
KIGFX::RENDER_SETTINGS* settings = static_cast<KIGFX::RENDER_SETTINGS*>( m_painter->GetSettings() );
|
||||
|
||||
m_viewControls->UpdateScrollbars();
|
||||
|
||||
try
|
||||
{
|
||||
m_view->UpdateItems();
|
||||
|
|
|
@ -91,6 +91,7 @@ private:
|
|||
|
||||
};
|
||||
|
||||
|
||||
GL_BITMAP_CACHE::~GL_BITMAP_CACHE()
|
||||
{
|
||||
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 )
|
||||
{
|
||||
auto it = m_bitmaps.find( aBitmap) ;
|
||||
|
@ -320,7 +322,7 @@ bool OPENGL_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
|
|||
|
||||
void OPENGL_GAL::BeginDrawing()
|
||||
{
|
||||
if( !IsShownOnScreen() )
|
||||
if( !IsShownOnScreen() || GetClientRect().IsEmpty() )
|
||||
return;
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
|
@ -491,7 +493,7 @@ void OPENGL_GAL::EndDrawing()
|
|||
|
||||
void OPENGL_GAL::BeginUpdate()
|
||||
{
|
||||
if( !IsShownOnScreen() )
|
||||
if( !IsShownOnScreen() || GetClientRect().IsEmpty() )
|
||||
return;
|
||||
|
||||
if( !isInitialized )
|
||||
|
|
|
@ -88,8 +88,9 @@ public:
|
|||
virtual ~CAIRO_GAL();
|
||||
|
||||
///> @copydoc GAL::IsVisible()
|
||||
bool IsVisible() const override {
|
||||
return IsShownOnScreen();
|
||||
bool IsVisible() const override
|
||||
{
|
||||
return IsShownOnScreen() && !GetClientRect().IsEmpty();
|
||||
}
|
||||
|
||||
// ---------------
|
||||
|
|
|
@ -90,13 +90,13 @@ public:
|
|||
virtual bool IsInitialized() const override
|
||||
{
|
||||
// is*Initialized flags, but it is enough for OpenGL to show up
|
||||
return IsShownOnScreen();
|
||||
return IsShownOnScreen() && !GetClientRect().IsEmpty();
|
||||
}
|
||||
|
||||
///> @copydoc GAL::IsVisible()
|
||||
bool IsVisible() const override
|
||||
{
|
||||
return IsShownOnScreen();
|
||||
return IsShownOnScreen() && !GetClientRect().IsEmpty();
|
||||
}
|
||||
|
||||
// ---------------
|
||||
|
|
Loading…
Reference in New Issue