Don't allow drawing to a zero-height or zero-width GAL canvas.
Fixes: lp:1793913
* https://bugs.launchpad.net/kicad/+bug/1793913
(cherry picked from commit 0309228276
)
This commit is contained in:
parent
4fcd80eda1
commit
1820e81f5e
|
@ -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();
|
||||
|
|
|
@ -222,7 +222,7 @@ bool OPENGL_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
|
|||
|
||||
void OPENGL_GAL::BeginDrawing()
|
||||
{
|
||||
if( !IsShownOnScreen() )
|
||||
if( !IsShownOnScreen() || GetClientRect().IsEmpty() )
|
||||
return;
|
||||
|
||||
#ifdef __WXDEBUG__
|
||||
|
@ -393,7 +393,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();
|
||||
}
|
||||
|
||||
// ---------------
|
||||
|
|
|
@ -89,13 +89,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