wxMemoryDC memdc;
wxBitmap bitmap(1, 1);
memdc.SelectObject(bitmap);
- memdc.Blit(0, 0, 1, 1, (wxDC*) this, x1, y1);
+ memdc.Blit(0, 0, 1, 1, GetOwner(), x1, y1);
memdc.SelectObject(wxNullBitmap);
wxImage image = bitmap.ConvertToImage();
xsrc = source->LogicalToDeviceX(xsrc);
ysrc = source->LogicalToDeviceY(ysrc);
- wxClientDCImpl *srcDC = (wxClientDCImpl*)source->GetImpl();
- wxMemoryDCImpl *memDC = (wxMemoryDCImpl*)source;
+ wxWindowDCImpl *srcDC = wxDynamicCast(source->GetImpl(), wxWindowDCImpl);
+ wxCHECK_MSG( srcDC, false, "source must be a window DC" );
+
+ // FIXME: this cast is not always valid, see the code using m_isMemDC
+ wxMemoryDCImpl *memDC = wx_static_cast(wxMemoryDCImpl *, srcDC);
bool use_bitmap_method = false;
bool is_mono = false;