From 9bfa4c6da33f83788358799a48d967426e2d5e09 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sat, 22 Sep 2018 12:56:36 +0200 Subject: [PATCH] further cleanup --- include/wx/osx/bitmap.h | 6 ------ src/osx/core/bitmap.cpp | 48 ++++------------------------------------- 2 files changed, 4 insertions(+), 50 deletions(-) diff --git a/include/wx/osx/bitmap.h b/include/wx/osx/bitmap.h index 364f1de6f8..4252da9f9c 100644 --- a/include/wx/osx/bitmap.h +++ b/include/wx/osx/bitmap.h @@ -83,12 +83,6 @@ protected: virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) wxOVERRIDE; private: -#if !wxOSX_BITMAP_NATIVE_ACCESS - wxMemoryBuffer m_memBuf ; - int m_bytesPerRow ; - int m_width ; - int m_height ; -#endif void DoCreateMaskBitmap(int width, int height, int bytesPerRow = -1); wxCFRef m_maskBitmap ; diff --git a/src/osx/core/bitmap.cpp b/src/osx/core/bitmap.cpp index 85d90e13bd..41162af49d 100644 --- a/src/osx/core/bitmap.cpp +++ b/src/osx/core/bitmap.cpp @@ -712,10 +712,8 @@ CGImageRef wxBitmapRefData::CreateCGImage() const alphaInfo = kCGImageAlphaFirst; #endif } -#if wxOSX_BITMAP_NATIVE_ACCESS memcpy(membuf.GetWriteBuf(imageSize), GetRawAccess(), imageSize); membuf.UngetWriteBuf(imageSize); -#endif } CGDataProviderRef dataProvider = NULL; @@ -1531,46 +1529,27 @@ wxMask::~wxMask() void wxMask::Init() { -#if !wxOSX_BITMAP_NATIVE_ACCESS - m_width = m_height = m_bytesPerRow = 0 ; -#endif } void *wxMask::GetRawAccess() const { wxCHECK_MSG( m_maskBitmap, NULL , wxT("invalid mask") ) ; -#if !wxOSX_BITMAP_NATIVE_ACCESS - return m_memBuf.GetData() ; -#else return CGBitmapContextGetData(m_maskBitmap); -#endif } int wxMask::GetBytesPerRow() const { -#if !wxOSX_BITMAP_NATIVE_ACCESS - return m_bytesPerRow ; -#else return CGBitmapContextGetBytesPerRow(m_maskBitmap); -#endif } int wxMask::GetWidth() const { -#if !wxOSX_BITMAP_NATIVE_ACCESS - return m_width ; -#else return CGBitmapContextGetWidth(m_maskBitmap); -#endif } int wxMask::GetHeight() const { -#if !wxOSX_BITMAP_NATIVE_ACCESS - return m_height ; -#else return CGBitmapContextGetHeight(m_maskBitmap); -#endif } @@ -1583,20 +1562,9 @@ void wxMask::DoCreateMaskBitmap(int width, int height, int bytesPerRow) if ( bytesPerRow < 0 ) bytesPerRow = GetBestBytesPerRow(width * kMaskBytesPerPixel); -#if !wxOSX_BITMAP_NATIVE_ACCESS - m_width = width; - m_height = height; - m_bytesPerRow = bytesPerRow; - size_t size = m_bytesPerRow * m_height; - unsigned char* data = (unsigned char*)m_memBuf.GetWriteBuf(size); -#else - unsigned char* data = NULL; -#endif - m_maskBitmap = CGBitmapContextCreate(data, width, height, kMaskBytesPerPixel * 8, bytesPerRow, colorspace, + + m_maskBitmap = CGBitmapContextCreate(NULL, width, height, kMaskBytesPerPixel * 8, bytesPerRow, colorspace, kCGImageAlphaNone); -#if !wxOSX_BITMAP_NATIVE_ACCESS - m_memBuf.UngetWriteBuf(size); -#endif wxASSERT_MSG(m_maskBitmap, wxT("Unable to create CGBitmapContext context")); } @@ -1636,16 +1604,12 @@ bool wxMask::Create(const wxMemoryBuffer& data,int width , int height , int byte bool wxMask::InitFromMonoBitmap(const wxBitmap& bitmap) { -#if wxOSX_BITMAP_NATIVE_ACCESS int m_width, m_height, m_bytesPerRow; -#endif m_width = bitmap.GetWidth() ; m_height = bitmap.GetHeight() ; DoCreateMaskBitmap(m_width, m_height); -#if wxOSX_BITMAP_NATIVE_ACCESS m_bytesPerRow = GetBytesPerRow(); -#endif // pixel access needs a non-const bitmap currently wxBitmap bmp(bitmap); @@ -1678,16 +1642,13 @@ bool wxMask::InitFromMonoBitmap(const wxBitmap& bitmap) bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour) { -#if wxOSX_BITMAP_NATIVE_ACCESS int m_width, m_height, m_bytesPerRow; -#endif + m_width = bitmap.GetWidth() ; m_height = bitmap.GetHeight() ; DoCreateMaskBitmap(m_width, m_height); -#if wxOSX_BITMAP_NATIVE_ACCESS m_bytesPerRow = GetBytesPerRow(); -#endif // pixel access needs a non-const bitmap currently wxBitmap bmp(bitmap); @@ -1722,12 +1683,11 @@ bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour) wxBitmap wxMask::GetBitmap() const { -#if wxOSX_BITMAP_NATIVE_ACCESS int m_width, m_height, m_bytesPerRow; m_width = GetWidth(); m_height = GetHeight(); m_bytesPerRow = GetBytesPerRow(); -#endif + wxBitmap bitmap(m_width, m_height, 32); wxNativePixelData data(bitmap);