X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/265a3864bbbc7ac8af309c80321efbba8c0ca6e9..374e9b153fcb3f4e547929ccc9b80bda76fd6f6e:/include/wx/dcbuffer.h diff --git a/include/wx/dcbuffer.h b/include/wx/dcbuffer.h index e7ccff4f55..cac6228a8e 100644 --- a/include/wx/dcbuffer.h +++ b/include/wx/dcbuffer.h @@ -37,7 +37,9 @@ public: } // Construct a wxBufferedDC using a user supplied buffer. - wxBufferedDC(wxDC *dc, const wxBitmap &buffer, int style = wxBUFFER_CLIENT_AREA) + wxBufferedDC(wxDC *dc, + const wxBitmap &buffer = wxNullBitmap, + int style = wxBUFFER_CLIENT_AREA) : m_dc( dc ), m_buffer( buffer ), m_style(style) @@ -67,7 +69,9 @@ public: // These reimplement the actions of the ctors for two stage creation, but // are not used by the ctors themselves to save a few cpu cycles. - void Init(wxDC *dc, const wxBitmap &buffer, int style = wxBUFFER_CLIENT_AREA) + void Init(wxDC *dc, + const wxBitmap &buffer=wxNullBitmap, + int style = wxBUFFER_CLIENT_AREA) { wxASSERT_MSG( m_dc == 0 && m_buffer == wxNullBitmap, _T("wxBufferedDC already initialised") ); @@ -112,7 +116,12 @@ private: // check that the bitmap is valid and use it void UseBuffer() { - wxASSERT_MSG( m_buffer.Ok(), _T("invalid bitmap in wxBufferedDC") ); + if (!m_buffer.Ok()) + { + wxCoord w, h; + m_dc->GetSize(&w, &h); + m_buffer = wxBitmap(w, h); + } SelectObject(m_buffer); }