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:
Vadim Zeitlin 2007-03-30 15:49:08 +00:00
parent 16fc7c4524
commit 641ed513f8

View File

@ -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;