From c2695fb3b15ca34114578adc398ac11d038240ad Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 11 Oct 2006 03:45:08 +0000 Subject: [PATCH] Restore a use case that was lost with the last set of updates, using a wxBufferedDC without a real DC, just a buffer. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/dcbufcmn.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/common/dcbufcmn.cpp b/src/common/dcbufcmn.cpp index fe80752412..a2ab613b46 100644 --- a/src/common/dcbufcmn.cpp +++ b/src/common/dcbufcmn.cpp @@ -97,22 +97,23 @@ void wxBufferedDC::UnMask() { if ( m_buffer ) { - wxASSERT_MSG( m_mainDc != NULL, - _T("No underlying DC associated with wxBufferedDC (anymore)") ); - wxDC* bufferDc = DetachDC(); wxASSERT( bufferDc->IsKindOf(CLASSINFO(wxMemoryDC)) ); - wxCoord x=0, y=0; + if (m_mainDc) + { + wxCoord x=0, y=0; - if (m_style & wxBUFFER_CLIENT_AREA) - bufferDc->GetDeviceOrigin(& x, & y); + if (m_style & wxBUFFER_CLIENT_AREA) + bufferDc->GetDeviceOrigin(&x, &y); - m_mainDc->Blit( 0, 0, - m_buffer->GetWidth(), m_buffer->GetHeight(), bufferDc, - -x, -y ); - m_mainDc = NULL; + m_mainDc->Blit( 0, 0, + m_buffer->GetWidth(), m_buffer->GetHeight(), bufferDc, + -x, -y ); + m_mainDc = NULL; + } + m_buffer = NULL; delete bufferDc; } @@ -127,7 +128,7 @@ void wxBufferedDC::UseBuffer() { wxASSERT(m_buffer); - wxMemoryDC* memoryDc = new wxMemoryDC(m_mainDc); + wxMemoryDC* memoryDc = m_mainDc ? new wxMemoryDC(m_mainDc): new wxMemoryDC(); memoryDc->SelectObject(*m_buffer); AttachDC(memoryDc); -- 2.45.2