X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ea57084d103187771c0306a6e1684e32244d6101..7d4194184e83bbccf1a88325cca59d8d0d2faef1:/src/msw/dcmemory.cpp diff --git a/src/msw/dcmemory.cpp b/src/msw/dcmemory.cpp index 51cefba945..1a4b151391 100644 --- a/src/msw/dcmemory.cpp +++ b/src/msw/dcmemory.cpp @@ -21,11 +21,13 @@ #endif #ifndef WX_PRECOMP +#include "wx/utils.h" #endif #include "wx/dcmemory.h" #include +#include "wx/msw/winundef.h" #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) @@ -38,7 +40,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC) wxMemoryDC::wxMemoryDC(void) { - m_hDC = (WXHDC) ::CreateCompatibleDC(NULL); + m_hDC = (WXHDC) ::CreateCompatibleDC((HDC) NULL); m_ok = (m_hDC != 0); m_bOwnsDC = TRUE; @@ -80,22 +82,26 @@ void wxMemoryDC::SelectObject(const wxBitmap& bitmap) // a device context if (bitmap.GetSelectedInto() && (bitmap.GetSelectedInto() != this)) { - wxFatalError("Error in wxMemoryDC::SelectObject\nBitmap is selected in another wxMemoryDC.\nDelete the first wxMemoryDC or use SelectObject(NULL)"); + 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())) - { - // Make a new bitmap that has the correct depth. - wxBitmap newBitmap = bitmap.GetBitmapForDC(* this); - - m_selectedBitmap = newBitmap ; - } - else - { +// 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; @@ -105,13 +111,13 @@ void wxMemoryDC::SelectObject(const wxBitmap& bitmap) if (bm == ERROR) { - wxFatalError("Error in wxMemoryDC::SelectObject\nBitmap may not be loaded, or may be selected in another wxMemoryDC.\nDelete the first wxMemoryDC to deselect bitmap."); + 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; } -void wxMemoryDC::GetSize(int *width, int *height) const +void wxMemoryDC::DoGetSize(int *width, int *height) const { if (!m_selectedBitmap.Ok()) {