fixing RawBitmap access
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37978 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user