From: Stefan Csomor Date: Fri, 10 Mar 2006 18:58:16 +0000 (+0000) Subject: fixing RawBitmap access X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6945b5878c8d46a56f1a59f558837a0943492f3c?hp=4b217ea0393beb4fa11248bd5ab3e8887670431c fixing RawBitmap access git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37978 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/bitmap.cpp b/src/mac/carbon/bitmap.cpp index 5abc83eb77..05cc1a72e7 100644 --- a/src/mac/carbon/bitmap.cpp +++ b/src/mac/carbon/bitmap.cpp @@ -1615,53 +1615,12 @@ void *wxBitmap::GetRawData(wxPixelDataBase& data, int bpp) data.m_height = GetHeight() ; data.m_stride = GetWidth() * 4 ; - return GetRawAccess() ; + return BeginRawAccess() ; } void wxBitmap::UngetRawData(wxPixelDataBase& dataBase) { - if ( !Ok() ) - return; - - // TODO: if we have some information about the API we should check - // this code looks strange... - - if ( !M_BITMAPDATA->HasAlpha() ) - return; - - wxAlphaPixelData& data = (wxAlphaPixelData&)dataBase; - int w = data.GetWidth(); - int h = data.GetHeight(); - - wxBitmap bmpMask( GetWidth(), GetHeight(), 32 ); - wxAlphaPixelData dataMask( bmpMask, data.GetOrigin(), wxSize( w, h ) ); - wxAlphaPixelData::Iterator pMask( dataMask ), p( data ); - - for ( int y = 0; y < h; y++ ) - { - wxAlphaPixelData::Iterator rowStartMask = pMask; - wxAlphaPixelData::Iterator rowStart = p; - - for ( int x = 0; x < w; x++ ) - { - const wxAlphaPixelData::Iterator::ChannelType alpha = p.Alpha(); - - pMask.Red() = alpha; - pMask.Green() = alpha; - pMask.Blue() = alpha; - - ++p; - ++pMask; - } - - p = rowStart; - p.OffsetY( data, 1 ); - - pMask = rowStartMask; - pMask.OffsetY( dataMask, 1 ); - } - - SetMask( new wxMask( bmpMask ) ); + EndRawAccess() ; } void wxBitmap::UseAlpha()