- const wxBitmapRefData *
- data = wx_static_cast(const wxBitmapRefData *, dataOrig);
- if ( !data )
- return NULL;
-
- // FIXME: this method is backwards, it should just create a new
- // wxBitmapRefData using its copy ctor but instead it modifies this
- // bitmap itself and then returns its m_refData -- which works, of
- // course (except in !wxUSE_WXDIB), but is completely illogical
- wxBitmap *self = wx_const_cast(wxBitmap *, this);
-
-#if wxUSE_WXDIB
- // copy the other bitmap
- if ( data->m_hBitmap )
- {
- wxDIB dib((HBITMAP)(data->m_hBitmap));
- self->CopyFromDIB(dib);
- }
- else
-#endif // wxUSE_WXDIB
- {
- // copy the bitmap data
- self->m_refData = new wxBitmapRefData(*data);
- }
-
- wxBitmapRefData * const
- selfdata = wx_static_cast(wxBitmapRefData *, m_refData);
-
- // copy also the mask
- wxMask * const maskSrc = data->GetMask();
- if ( maskSrc )
- {
- selfdata->SetMask(new wxMask(*maskSrc));
- }
-
- return selfdata;