check for alpha first, then mask, in BlurHorizontal/Vertical(): not only this makes more sense but it also prevents crashing for images which have both (see coverity CID 172)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45151 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
16fc7c4524
commit
641ed513f8
@ -754,20 +754,17 @@ wxImage wxImage::BlurHorizontal(int blurRadius)
|
||||
unsigned char* dst_alpha = NULL;
|
||||
|
||||
// Check for a mask or alpha
|
||||
if ( M_IMGDATA->m_hasMask )
|
||||
if ( src_alpha )
|
||||
{
|
||||
ret_image.SetAlpha();
|
||||
dst_alpha = ret_image.GetAlpha();
|
||||
}
|
||||
else if ( M_IMGDATA->m_hasMask )
|
||||
{
|
||||
ret_image.SetMaskColour(M_IMGDATA->m_maskRed,
|
||||
M_IMGDATA->m_maskGreen,
|
||||
M_IMGDATA->m_maskBlue);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( src_alpha )
|
||||
{
|
||||
ret_image.SetAlpha();
|
||||
dst_alpha = ret_image.GetAlpha();
|
||||
}
|
||||
}
|
||||
|
||||
// number of pixels we average over
|
||||
const int blurArea = blurRadius*2 + 1;
|
||||
@ -872,20 +869,17 @@ wxImage wxImage::BlurVertical(int blurRadius)
|
||||
unsigned char* dst_alpha = NULL;
|
||||
|
||||
// Check for a mask or alpha
|
||||
if ( M_IMGDATA->m_hasMask )
|
||||
if ( src_alpha )
|
||||
{
|
||||
ret_image.SetAlpha();
|
||||
dst_alpha = ret_image.GetAlpha();
|
||||
}
|
||||
else if ( M_IMGDATA->m_hasMask )
|
||||
{
|
||||
ret_image.SetMaskColour(M_IMGDATA->m_maskRed,
|
||||
M_IMGDATA->m_maskGreen,
|
||||
M_IMGDATA->m_maskBlue);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( src_alpha )
|
||||
{
|
||||
ret_image.SetAlpha();
|
||||
dst_alpha = ret_image.GetAlpha();
|
||||
}
|
||||
}
|
||||
|
||||
// number of pixels we average over
|
||||
const int blurArea = blurRadius*2 + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user