- if (!m_buffer.Ok())
- {
- wxCoord w, h;
- m_dc->GetSize(&w, &h);
- m_buffer = wxBitmap(w, h);
- }
-
- SelectObject(m_buffer);
+ wxASSERT_MSG( !m_dc && !m_buffer, _T("wxBufferedDC already initialised") );
+ wxCHECK_RET( dc, _T("can't associate NULL DC with wxBufferedDC") );
+
+ m_dc = dc;
+ m_style = style;
+
+ // inherit the same layout direction as the original DC
+ SetLayoutDirection(dc->GetLayoutDirection());