X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6d51f2202930063f397b8fd9a892bc5229963a91..87df17a11b0017d31c09f767bd921abb27193bee:/src/msw/bitmap.cpp diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 959590f879..4c21494fcb 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -45,6 +45,7 @@ #include "wx/msw/dib.h" #include "wx/image.h" +#include "wx/xpmdecod.h" // missing from mingw32 header #ifndef CLR_INVALID @@ -283,9 +284,20 @@ 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(); - return Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); + wxCHECK_MSG( data != NULL, FALSE, wxT("invalid bitmap data") ) + + wxXPMDecoder decoder; + wxImage img = decoder.ReadData(data); + wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid bitmap data") ) + + *this = wxBitmap(img); + return TRUE; +#else + return FALSE; +#endif } wxBitmap::wxBitmap(int w, int h, int d)