X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/87f83ac8676d83b1bc75cbb0a6b4cf612f86bc2b..3087eaea04bb4f8fe6aef1c649fe86fa1691894a:/src/dfb/bitmap.cpp diff --git a/src/dfb/bitmap.cpp b/src/dfb/bitmap.cpp index 60e0a9e861..72f4fda4c0 100644 --- a/src/dfb/bitmap.cpp +++ b/src/dfb/bitmap.cpp @@ -24,9 +24,6 @@ #include "wx/colour.h" #include "wx/image.h" -#warning "move this to common" -#include "wx/xpmdecod.h" - #include "wx/dfb/private.h" //----------------------------------------------------------------------------- @@ -72,8 +69,7 @@ public: wxBitmapRefData(const wxBitmapRefData& data) { - if ( data.m_surface ) - m_surface = data.m_surface->Clone(); + m_surface = data.m_surface ? data.m_surface->Clone() : NULL; m_mask = data.m_mask ? new wxMask(*data.m_mask) : NULL; #if wxUSE_PALETTE @@ -81,7 +77,7 @@ public: #endif } - ~wxBitmapRefData() + virtual ~wxBitmapRefData() { delete m_mask; #if wxUSE_PALETTE @@ -102,7 +98,7 @@ public: // wxBitmap //----------------------------------------------------------------------------- -IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxObject) +IMPLEMENT_ABSTRACT_CLASS(wxBitmapHandler, wxBitmapHandlerBase) IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxBitmapBase) wxBitmap::wxBitmap(int width, int height, int depth) @@ -138,25 +134,6 @@ bool wxBitmap::Create(int width, int height, int depth) return Create(wxIDirectFB::Get()->CreateSurface(&desc)); } -#warning "FIXME: move this to common code" -bool wxBitmap::CreateFromXpm(const char **bits) -{ - wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") ); - -#if wxUSE_IMAGE && wxUSE_XPM - wxXPMDecoder decoder; - wxImage img = decoder.ReadData(bits); - wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") ); - - *this = wxBitmap(img); - - return true; -#else - wxFAIL_MSG( _T("creating bitmaps from XPMs not supported") ); - return false; -#endif // wxUSE_IMAGE && wxUSE_XPM -} - #if wxUSE_IMAGE wxBitmap::wxBitmap(const wxImage& image, int depth) { @@ -211,17 +188,11 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) wxFAIL_MSG( _T("not implemented") ); } -bool wxBitmap::Ok() const +bool wxBitmap::IsOk() const { return (m_refData != NULL && M_BITMAP->m_surface); } -bool wxBitmap::operator==(const wxBitmap& bmp) const -{ - // FIXME: is this the right way to compare bitmaps? - return (m_refData == bmp.m_refData); -} - int wxBitmap::GetHeight() const { wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") ); @@ -258,6 +229,7 @@ void wxBitmap::SetMask(wxMask *mask) { wxCHECK_RET( Ok(), wxT("invalid bitmap") ); + AllocExclusive(); delete M_BITMAP->m_mask; M_BITMAP->m_mask = mask; } @@ -350,6 +322,7 @@ void wxBitmap::SetPalette(const wxPalette& palette) wxCHECK_RET( Ok(), wxT("invalid bitmap") ); wxCHECK_RET( GetDepth() > 1 && GetDepth() <= 8, wxT("cannot set palette for bitmap of this depth") ); + AllocExclusive(); delete M_BITMAP->m_palette; M_BITMAP->m_palette = NULL;