Alexandre Julliard : shell32: Fix marshalling of 1-bpp systray icons.
Alexandre Julliard
julliard at winehq.org
Fri May 7 09:41:14 CDT 2010
Module: wine
Branch: master
Commit: 96a939eee1617039949b249b697b9e9f8fd1a160
URL: http://source.winehq.org/git/wine.git/?a=commit;h=96a939eee1617039949b249b697b9e9f8fd1a160
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri May 7 12:45:55 2010 +0200
shell32: Fix marshalling of 1-bpp systray icons.
---
dlls/shell32/systray.c | 35 +++++++++++++++++++++++------------
1 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/dlls/shell32/systray.c b/dlls/shell32/systray.c
index 3e0b5ac..59df2f8 100644
--- a/dlls/shell32/systray.c
+++ b/dlls/shell32/systray.c
@@ -163,43 +163,54 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid)
BITMAP bmMask;
BITMAP bmColour;
LONG cbMaskBits;
- LONG cbColourBits;
+ LONG cbColourBits = 0;
char *buffer;
if (!GetIconInfo(nid->hIcon, &iconinfo))
goto noicon;
if (!GetObjectW(iconinfo.hbmMask, sizeof(bmMask), &bmMask) ||
- !GetObjectW(iconinfo.hbmColor, sizeof(bmColour), &bmColour))
+ (iconinfo.hbmColor && !GetObjectW(iconinfo.hbmColor, sizeof(bmColour), &bmColour)))
{
DeleteObject(iconinfo.hbmMask);
- DeleteObject(iconinfo.hbmColor);
+ if (iconinfo.hbmColor) DeleteObject(iconinfo.hbmColor);
goto noicon;
}
cbMaskBits = (bmMask.bmPlanes * bmMask.bmWidth * bmMask.bmHeight * bmMask.bmBitsPixel + 15) / 16 * 2;
- cbColourBits = (bmColour.bmPlanes * bmColour.bmWidth * bmColour.bmHeight * bmColour.bmBitsPixel + 15) / 16 * 2;
+ if (iconinfo.hbmColor)
+ cbColourBits = (bmColour.bmPlanes * bmColour.bmWidth * bmColour.bmHeight * bmColour.bmBitsPixel + 15) / 16 * 2;
cds.cbData = sizeof(*data) + cbMaskBits + cbColourBits;
buffer = HeapAlloc(GetProcessHeap(), 0, cds.cbData);
if (!buffer)
{
DeleteObject(iconinfo.hbmMask);
- DeleteObject(iconinfo.hbmColor);
+ if (iconinfo.hbmColor) DeleteObject(iconinfo.hbmColor);
return FALSE;
}
data = (struct notify_data *)buffer;
memset( data, 0, sizeof(*data) );
- data->width = bmColour.bmWidth;
- data->height = bmColour.bmHeight;
- data->planes = bmColour.bmPlanes;
- data->bpp = bmColour.bmBitsPixel;
buffer += sizeof(*data);
GetBitmapBits(iconinfo.hbmMask, cbMaskBits, buffer);
- buffer += cbMaskBits;
- GetBitmapBits(iconinfo.hbmColor, cbColourBits, buffer);
+ if (!iconinfo.hbmColor)
+ {
+ data->width = bmMask.bmWidth;
+ data->height = bmMask.bmHeight / 2;
+ data->planes = 1;
+ data->bpp = 1;
+ }
+ else
+ {
+ data->width = bmColour.bmWidth;
+ data->height = bmColour.bmHeight;
+ data->planes = bmColour.bmPlanes;
+ data->bpp = bmColour.bmBitsPixel;
+ buffer += cbMaskBits;
+ GetBitmapBits(iconinfo.hbmColor, cbColourBits, buffer);
+ DeleteObject(iconinfo.hbmColor);
+ }
DeleteObject(iconinfo.hbmMask);
- DeleteObject(iconinfo.hbmColor);
}
noicon:
More information about the wine-cvs
mailing list