+void wxDC::DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask )
+{
+ if (!bmp.Ok())
+ return;
+
+ // If we're not drawing transparently, and not drawing to a printer,
+ // optimize this function to use Windows functions.
+ if (!useMask && !IsKindOf(CLASSINFO(wxPrinterDC)))
+ {
+ HDC cdc = (HDC)m_hDC;
+ HDC memdc = ::CreateCompatibleDC( cdc );
+ HBITMAP hbitmap = (HBITMAP) bmp.GetHBITMAP( );
+ ::SelectObject( memdc, hbitmap );
+ ::BitBlt( cdc, x, y, bmp.GetWidth(), bmp.GetHeight(), memdc, 0, 0, SRCCOPY);
+ ::SelectObject( memdc, 0 );
+ ::DeleteDC( memdc );
+ }
+ else
+ {
+ // Rather than reproduce wxDC::Blit, let's do it at the wxWin API level
+ wxMemoryDC memDC;
+ memDC.SelectObject(bmp);
+
+ /* Not sure if we need this. The mask should leave the
+ * masked areas as per the original background of this DC.
+ */
+/*
+ // There might be transparent areas, so make these
+ // the same colour as this DC
+ memDC.SetBackground(* GetBackground());
+ memDC.Clear();
+*/
+
+ Blit(x, y, bmp.GetWidth(), bmp.GetHeight(), & memDC, 0, 0, wxCOPY, useMask);
+
+ memDC.SelectObject(wxNullBitmap);
+ }
+}
+