#endif
#include "wx/msw/private.h"
+#include "wx/msw/dc.h"
#if wxUSE_WXDIB
#include "wx/msw/dib.h"
m_bitmapMask = new wxMask(*data.m_bitmapMask);
// FIXME: we don't copy m_hBitmap currently but we should, see wxBitmap::
- // CloneRefData()
+ // CloneGDIRefData()
wxASSERT_MSG( !data.m_isDIB,
_T("can't copy bitmap locked for raw access!") );
return new wxBitmapRefData;
}
-wxObjectRefData *wxBitmap::CloneRefData(const wxObjectRefData *dataOrig) const
+wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *dataOrig) const
{
const wxBitmapRefData *
data = wx_static_cast(const wxBitmapRefData *, dataOrig);
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 )
{
- wxBitmapRefData *selfdata = wx_static_cast(wxBitmapRefData *, m_refData);
-
selfdata->SetMask(new wxMask(*maskSrc));
}
- return m_refData;
+ return selfdata;
}
bool wxBitmap::CopyFromIconOrCursor(const wxGDIImage& icon,
bool wxBitmap::Create(int width, int height, const wxDC& dc)
{
- wxCHECK_MSG( dc.Ok(), false, _T("invalid HDC in wxBitmap::Create()") );
+ wxCHECK_MSG( dc.IsOk(), false, _T("invalid HDC in wxBitmap::Create()") );
- return DoCreate(width, height, -1, dc.GetHDC());
+ const wxMSWDCImpl *impl = wxDynamicCast( dc.GetImpl(), wxMSWDCImpl );
+
+ if (impl)
+ return DoCreate(width, height, -1, impl->GetHDC());
+ else
+ return false;
}
bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc)
bool wxBitmap::CreateFromImage(const wxImage& image, const wxDC& dc)
{
- wxCHECK_MSG( dc.Ok(), false,
+ wxCHECK_MSG( dc.IsOk(), false,
_T("invalid HDC in wxBitmap::CreateFromImage()") );
- return CreateFromImage(image, -1, dc.GetHDC());
+ const wxMSWDCImpl *impl = wxDynamicCast( dc.GetImpl(), wxMSWDCImpl );
+
+ if (impl)
+ return CreateFromImage(image, -1, impl->GetHDC());
+ else
+ return false;
}
#if wxUSE_WXDIB