X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/074308476d094fb250dbf4ac64595694eb3d10ef..40cc34ec564f7c036724573caba0b4e5643018d8:/src/msw/bitmap.cpp diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index e4cbfdc9bc..7646220beb 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -241,12 +241,6 @@ void wxBitmapRefData::Free() // wxBitmap creation // ---------------------------------------------------------------------------- -// this function should be called from all wxBitmap ctors -void wxBitmap::Init() -{ - // m_refData = NULL; done in the base class ctor -} - wxGDIImageRefData *wxBitmap::CreateData() const { return new wxBitmapRefData; @@ -416,8 +410,6 @@ wxBitmap::~wxBitmap() wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) { - Init(); - #ifndef __WXMICROWIN__ wxBitmapRefData *refData = new wxBitmapRefData; m_refData = refData; @@ -483,9 +475,7 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) // Create from XPM data bool wxBitmap::CreateFromXpm(const char **data) { -#if wxUSE_IMAGE && wxUSE_XPM - Init(); - +#if wxUSE_IMAGE && wxUSE_XPM && wxUSE_WXDIB wxCHECK_MSG( data != NULL, false, wxT("invalid bitmap data") ) wxXPMDecoder decoder; @@ -502,29 +492,21 @@ bool wxBitmap::CreateFromXpm(const char **data) wxBitmap::wxBitmap(int w, int h, int d) { - Init(); - (void)Create(w, h, d); } wxBitmap::wxBitmap(int w, int h, const wxDC& dc) { - Init(); - (void)Create(w, h, dc); } wxBitmap::wxBitmap(void *data, long type, int width, int height, int depth) { - Init(); - (void)Create(data, type, width, height, depth); } wxBitmap::wxBitmap(const wxString& filename, wxBitmapType type) { - Init(); - LoadFile(filename, (int)type); } @@ -798,8 +780,6 @@ wxImage wxBitmap::ConvertToImage() const // wxImage to/from conversions // ---------------------------------------------------------------------------- -#if wxUSE_WXDIB - bool wxBitmap::CreateFromImage(const wxImage& image, int depth) { return CreateFromImage(image, depth, 0); @@ -813,6 +793,8 @@ bool wxBitmap::CreateFromImage(const wxImage& image, const wxDC& dc) return CreateFromImage(image, -1, dc.GetHDC()); } +#if wxUSE_WXDIB + bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) { wxCHECK_MSG( image.Ok(), false, wxT("invalid image") ); @@ -826,8 +808,9 @@ bool wxBitmap::CreateFromImage(const wxImage& image, int depth, WXHDC hdc) wxDIB dib(image); if ( !dib.IsOk() ) return false; - if (depth == -1) - depth = dib.GetDepth(); // Get depth from image if none specified + + if ( depth == -1 ) + depth = dib.GetDepth(); // Get depth from image if none specified // store the bitmap parameters wxBitmapRefData *refData = new wxBitmapRefData; @@ -991,7 +974,22 @@ wxImage wxBitmap::ConvertToImage() const return image; } -#endif // wxUSE_WXDIB +#else // !wxUSE_WXDIB + +bool +wxBitmap::CreateFromImage(const wxImage& WXUNUSED(image), + int WXUNUSED(depth), + WXHDC WXUNUSED(hdc)) +{ + return false; +} + +wxImage wxBitmap::ConvertToImage() const +{ + return wxImage(); +} + +#endif // wxUSE_WXDIB/!wxUSE_WXDIB #endif // wxUSE_IMAGE @@ -1011,7 +1009,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type) return handler->LoadFile(this, filename, type, -1, -1); } -#if wxUSE_IMAGE +#if wxUSE_IMAGE && wxUSE_WXDIB else // no bitmap handler found { wxImage image; @@ -1055,7 +1053,7 @@ bool wxBitmap::SaveFile(const wxString& filename, { return handler->SaveFile(this, filename, type, palette); } -#if wxUSE_IMAGE +#if wxUSE_IMAGE && wxUSE_WXDIB else // no bitmap handler found { // FIXME what about palette? shouldn't we use it?