git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20200
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
{
wxCHECK_RET( data, _T("NULL pointer in wxBitmap::UngetRawData()") );
{
wxCHECK_RET( data, _T("NULL pointer in wxBitmap::UngetRawData()") );
+ if ( !*data )
+ {
+ // invalid data, don't crash -- but don't assert neither as we're
+ // called automatically from wxRawBitmapData dtor and so there is no
+ // way to prevent this from happening
+ return;
+ }
+
// AlphaBlend() wants to have premultiplied source alpha but wxRawBitmap
// API uses normal, not premultiplied, colours, so adjust them here now
wxRawBitmapIterator p(*data);
// AlphaBlend() wants to have premultiplied source alpha but wxRawBitmap
// API uses normal, not premultiplied, colours, so adjust them here now
wxRawBitmapIterator p(*data);
{
const unsigned alpha = p.Alpha();
{
const unsigned alpha = p.Alpha();
- p.Red() = (p.Red() * alpha) / 255;
- p.Blue() = (p.Blue() * alpha) / 255;
- p.Green() = (p.Green() * alpha) / 255;
+ p.Red() = (p.Red() * alpha + 127) / 255;
+ p.Blue() = (p.Blue() * alpha + 127) / 255;
+ p.Green() = (p.Green() * alpha + 127) / 255;