X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/54c5d4fa433ca35139919e39f56b7276a77d816a..58ce18f2fdadecffb21e27555115af708325cf18:/src/osx/core/bitmap.cpp diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index dc09e4a12b..64d0b39e2d 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -21,6 +21,8 @@ #endif #include "wx/metafile.h" +#include "wx/xpmdecod.h" + #include "wx/rawbmp.h" IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) @@ -65,11 +67,9 @@ public: void Free(); void SetOk( bool isOk) { m_ok = isOk; } -#if WXWIN_COMPATIBILITY_2_8 void SetWidth( int width ) { m_width = width; } void SetHeight( int height ) { m_height = height; } void SetDepth( int depth ) { m_depth = depth; } -#endif int GetWidth() const { return m_width; } int GetHeight() const { return m_height; } @@ -109,7 +109,7 @@ public: CGContextRef GetBitmapContext() const; int GetBytesPerRow() const { return m_bytesPerRow; } -private: + private : bool Create(int width , int height , int depth); void Init(); @@ -510,10 +510,10 @@ IconRef wxBitmapRefData::GetIconRef() { // setup the header properly - Handle data; - Handle maskdata; - unsigned char * maskptr; - unsigned char * ptr; + Handle data = NULL ; + Handle maskdata = NULL ; + unsigned char * maskptr = NULL ; + unsigned char * ptr = NULL ; size_t datasize, masksize ; datasize = sz * sz * 4 ; @@ -639,6 +639,9 @@ CGImageRef wxBitmapRefData::CreateCGImage() const { if ( m_depth != 1 && m_bitmapMask == NULL ) { +#if 0 + // in order for this code to work properly, wxMask would have to invert black and white + // in the native bitmap if ( m_bitmapMask ) { CGImageRef tempImage = CGBitmapContextCreateImage( m_hBitmap ); @@ -648,6 +651,7 @@ CGImageRef wxBitmapRefData::CreateCGImage() const CGImageRelease(tempImage); } else +#endif image = CGBitmapContextCreateImage( m_hBitmap ); } else @@ -778,11 +782,7 @@ void wxBitmapRefData::Free() m_hBitmap = NULL ; } - if (m_bitmapMask) - { - delete m_bitmapMask; - m_bitmapMask = NULL; - } + wxDELETE(m_bitmapMask); } wxBitmapRefData::~wxBitmapRefData() @@ -1024,7 +1024,7 @@ IconRef wxBitmap::CreateIconRef() const WX_NSImage wxBitmap::GetNSImage() const { wxCFRef< CGImageRef > cgimage(CreateCGImage()); - return wxOSXCreateNSImageFromCGImage( cgimage ); + return wxOSXGetNSImageFromCGImage( cgimage ); } #endif @@ -1034,7 +1034,7 @@ WX_NSImage wxBitmap::GetNSImage() const WX_UIImage wxBitmap::GetUIImage() const { wxCFRef< CGImageRef > cgimage(CreateCGImage()); - return wxOSXCreateUIImageFromCGImage( cgimage ); + return wxOSXGetUIImageFromCGImage( cgimage ); } #endif @@ -1403,7 +1403,6 @@ bool wxBitmap::HasAlpha() const return M_BITMAPDATA->HasAlpha() ; } -#if WXWIN_COMPATIBILITY_2_8 void wxBitmap::SetWidth(int w) { AllocExclusive(); @@ -1421,7 +1420,6 @@ void wxBitmap::SetDepth(int d) AllocExclusive(); M_BITMAPDATA->SetDepth(d); } -#endif // WXWIN_COMPATIBILITY_2_8 void wxBitmap::SetOk(bool isOk) {