X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/10fcf31a2cefc6a8224a33038cb255c082669d5f..774b322d020db43bf4abf70e67cf22cb97d461bb:/src/msw/bitmap.cpp diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 29926d61d2..9498c65e43 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -77,22 +77,14 @@ wxBitmapRefData::wxBitmapRefData() wxBitmapRefData::~wxBitmapRefData() { - if (m_selectedInto) - { - wxChar buf[200]; - wxSprintf(buf, _T("Bitmap was deleted without selecting out of wxMemoryDC %X."), (unsigned int) m_selectedInto); - wxFatalError(buf); - } - if (m_hBitmap) - { - DeleteObject((HBITMAP) m_hBitmap); - } - m_hBitmap = 0 ; + wxASSERT_MSG( !m_selectedInto, + wxT("deleting bitmap still selected into wxMemoryDC") ); - if (m_bitmapMask) - delete m_bitmapMask; - m_bitmapMask = NULL; + if ( m_hBitmap) + DeleteObject((HBITMAP) m_hBitmap); + if ( m_bitmapMask ) + delete m_bitmapMask; } // ---------------------------------------------------------------------------- @@ -143,12 +135,9 @@ bool wxBitmap::FreeResource(bool WXUNUSED(force)) if ( !M_BITMAPDATA ) return FALSE; - if (M_BITMAPDATA->m_selectedInto) - { - wxChar buf[200]; - wxSprintf(buf, _T("Bitmap %X was deleted without selecting out of wxMemoryDC %X."), (unsigned int) this, (unsigned int) M_BITMAPDATA->m_selectedInto); - wxFatalError(buf); - } + wxASSERT_MSG( !M_BITMAPDATA->m_selectedInto, + wxT("freeing bitmap still selected into wxMemoryDC") ); + if (M_BITMAPDATA->m_hBitmap) { DeleteObject((HBITMAP) M_BITMAPDATA->m_hBitmap); @@ -255,7 +244,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type) wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning(_T("no bitmap handler for type %d defined."), type); + wxLogWarning(wxT("no bitmap handler for type %d defined."), type); return FALSE; } @@ -272,7 +261,7 @@ bool wxBitmap::Create(void *data, long type, int width, int height, int depth) wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning(_T("no bitmap handler for type %d defined."), type); + wxLogWarning(wxT("no bitmap handler for type %d defined."), type); return FALSE; } @@ -285,7 +274,7 @@ bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *pal wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning(_T("no bitmap handler for type %d defined."), type); + wxLogWarning(wxT("no bitmap handler for type %d defined."), type); return FALSE; } @@ -352,9 +341,10 @@ void wxBitmap::SetMask(wxMask *mask) void wxBitmap::SetHBITMAP(WXHBITMAP bmp) { if (!M_BITMAPDATA) - m_refData = new wxBitmapRefData; + m_refData = new wxBitmapRefData; M_BITMAPDATA->m_hBitmap = bmp; + M_BITMAPDATA->m_ok = bmp != 0; } void wxBitmap::AddHandler(wxBitmapHandler *handler) @@ -682,7 +672,7 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long } // it's probably not found - wxLogError(_T("Can't load bitmap '%s' from resources! Check .rc file."), name.c_str()); + wxLogError(wxT("Can't load bitmap '%s' from resources! Check .rc file."), name.c_str()); return FALSE; }