#include "wx/image.h"
 #endif
 
+#include "wx/os2/dc.h"
 #include "wx/os2/private.h"
 
 #include "wx/xpmdecod.h"
 // wxBitmap creation
 // ----------------------------------------------------------------------------
 
-wxGDIRefData* wxBitmap::CreateGDIRefData() const
-{
-    return new wxBitmapRefData;
-}
-
 wxGDIRefData* wxBitmap::CloneGDIRefData(const wxGDIRefData* data) const
 {
     return new wxBitmapRefData(*wx_static_cast(const wxBitmapRefData *, data));
     //
     // May already be selected into a PS
     //
-    if ((pDC = GetSelectedInto()) != NULL)
+    pDC = GetSelectedInto();
+    const wxPMDCImpl *impl; 
+    if (pDC != NULL &&
+        (impl = wxDynamicCast( pDC->GetImpl(), wxPMDCImpl )) != NULL)
     {
-        hPSMem = pDC->GetHPS();
+        hPSMem = impl->GetHPS();
     }
     else
     {