X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a96827606ef54312168c7f48aea419d36c4b2f43..eea4d01c65f9b29baa1193db762b4c6b8144af24:/src/common/dcbufcmn.cpp diff --git a/src/common/dcbufcmn.cpp b/src/common/dcbufcmn.cpp index 58d40b5f9b..2a8314d43e 100644 --- a/src/common/dcbufcmn.cpp +++ b/src/common/dcbufcmn.cpp @@ -105,6 +105,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxSharedDCBufferManager, wxModule) void wxBufferedDC::UseBuffer(wxCoord w, wxCoord h) { + wxCHECK_RET( w >= -1 && h >= -1, "Invalid buffer size" ); + if ( !m_buffer || !m_buffer->IsOk() ) { if ( w == -1 || h == -1 ) @@ -118,18 +120,21 @@ void wxBufferedDC::UseBuffer(wxCoord w, wxCoord h) // now that the DC is valid we can inherit the attributes (fonts, colours, // layout direction, ...) from the original DC - if ( m_dc->IsOk() ) + if ( m_dc && m_dc->IsOk() ) CopyAttributes(*m_dc); } void wxBufferedDC::UnMask() { - wxCHECK_RET( m_dc, _T("no underlying wxDC?") ); - wxASSERT_MSG( m_buffer && m_buffer->IsOk(), _T("invalid backing store") ); + wxCHECK_RET( m_dc, wxT("no underlying wxDC?") ); + wxASSERT_MSG( m_buffer && m_buffer->IsOk(), wxT("invalid backing store") ); wxCoord x = 0, y = 0; + // Ensure the scale matches the device + SetUserScale(1.0, 1.0); + if ( m_style & wxBUFFER_CLIENT_AREA ) GetDeviceOrigin(&x, &y);