- }
-
- // Do own check for whether the bitmap is already selected into
- // a device context
- if (bitmap.GetSelectedInto() && (bitmap.GetSelectedInto() != this))
- {
- wxFatalError(_T("Error in wxMemoryDC::SelectObject\nBitmap is selected in another wxMemoryDC.\nDelete the first wxMemoryDC or use SelectObject(NULL)"));
- return;
- }
-
- // Check if the bitmap has the correct depth for this device context
-// if (bitmap.Ok() && (bitmap.GetDepth() != GetDepth()))
- // JACS 11/12/98: disabling this since the Forty Thieves sample
- // shows this not working properly. In fact, if loading from a resource,
- // the depth should become the screen depth, so why was it being called?
-// if (0)
-// {
-// // Make a new bitmap that has the correct depth.
-// wxBitmap newBitmap = bitmap.GetBitmapForDC(* this);
-//
-// m_selectedBitmap = newBitmap ;
-// }
-// else
-// {
- m_selectedBitmap = bitmap;
-// }
-
- if (!m_selectedBitmap.Ok())
- return;
-
- m_selectedBitmap.SetSelectedInto(this);
- HBITMAP bm = (HBITMAP) ::SelectObject((HDC) m_hDC, (HBITMAP) m_selectedBitmap.GetHBITMAP());
-
- if (bm == ERROR)
- {
- wxFatalError(_T("Error in wxMemoryDC::SelectObject\nBitmap may not be loaded, or may be selected in another wxMemoryDC.\nDelete the first wxMemoryDC to deselect bitmap."));
- }
- else if (!m_oldBitmap)
- m_oldBitmap = (WXHBITMAP) bm;