windowscodecs: Ignore the alpha channel of ICO files if it's empty.

This commit is contained in:
Vincent Povirk 2011-01-10 14:36:19 -06:00 committed by Alexandre Julliard
parent 226c44097b
commit d747652102
1 changed files with 24 additions and 0 deletions

View File

@ -277,6 +277,30 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result)
IWICBitmapFrameDecode_Release(framedecode);
}
if (SUCCEEDED(hr) && has_alpha)
{
/* If the alpha channel is fully transparent, we should ignore it. */
int nonzero_alpha = 0;
int i;
for (i=0; i<(result->height*result->width); i++)
{
if (result->bits[i*4+3] != 0)
{
nonzero_alpha = 1;
break;
}
}
if (!nonzero_alpha)
{
for (i=0; i<(result->height*result->width); i++)
result->bits[i*4+3] = 0xff;
has_alpha = FALSE;
}
}
if (SUCCEEDED(hr) && !has_alpha)
{
/* set alpha data based on the AND mask */