Erase overlay contents when resetting it in wxOSX

Without this, the old contents continues to be shown for some time
before the display was refreshed.
This commit is contained in:
Vadim Zeitlin 2024-02-13 01:00:48 +01:00
parent 0217f54894
commit 4261e1d07d

View file

@ -157,6 +157,11 @@ wxOverlay::Impl* wxOverlay::Create()
wxOverlayImpl::~wxOverlayImpl()
{
// Set it to null before calling Reset() to prevent it from drawing
// anything: this is not needed when destroying the overlay and would
// result in problems.
m_window = nullptr;
Reset();
}
@ -275,6 +280,15 @@ void wxOverlayImpl::Clear(wxDC* dc)
void wxOverlayImpl::Reset()
{
if ( m_window )
{
// erase whatever was drawn on the overlay the last time
wxClientDC dc(m_window);
BeginDrawing(&dc);
Clear(&dc);
EndDrawing(&dc);
}
if ( m_overlayContext )
{
[(id)m_overlayContext release];