Vincent Povirk : windowscodecs: Ignore the alpha channel of ICO files if it 's empty.
Alexandre Julliard
julliard at winehq.org
Tue Jan 11 10:08:25 CST 2011
Module: wine
Branch: master
Commit: d747652102d6e1e5662a0f49da7ffdbce3a3f460
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d747652102d6e1e5662a0f49da7ffdbce3a3f460
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Mon Jan 10 14:36:19 2011 -0600
windowscodecs: Ignore the alpha channel of ICO files if it's empty.
---
dlls/windowscodecs/icoformat.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/dlls/windowscodecs/icoformat.c b/dlls/windowscodecs/icoformat.c
index e6a590f..1e939d7 100644
--- a/dlls/windowscodecs/icoformat.c
+++ b/dlls/windowscodecs/icoformat.c
@@ -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 */
More information about the wine-cvs
mailing list