Alexandre Julliard : user: Reimplement GetIconInfo16 using the 16-bit icon structure directly.
Alexandre Julliard
julliard at winehq.org
Tue Feb 2 10:45:29 CST 2010
Module: wine
Branch: master
Commit: e474bfe0f39ed13f0364cccb273fbe368653b2d9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e474bfe0f39ed13f0364cccb273fbe368653b2d9
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Feb 1 17:31:27 2010 +0100
user: Reimplement GetIconInfo16 using the 16-bit icon structure directly.
---
dlls/user.exe16/user.c | 47 ++++++++++++++++++++++++++++++++++++++---------
1 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/dlls/user.exe16/user.c b/dlls/user.exe16/user.c
index 0b321b7..7d60bac 100644
--- a/dlls/user.exe16/user.c
+++ b/dlls/user.exe16/user.c
@@ -265,6 +265,8 @@ struct cache_entry
static struct list icon_cache = LIST_INIT( icon_cache );
+static const WORD ICON_HOTSPOT = 0x4242;
+
static HICON16 alloc_icon_handle( unsigned int size )
{
HGLOBAL16 handle = GlobalAlloc16( GMEM_MOVEABLE, size );
@@ -2117,15 +2119,43 @@ BOOL16 WINAPI DrawIconEx16(HDC16 hdc, INT16 xLeft, INT16 yTop, HICON16 hIcon,
*/
BOOL16 WINAPI GetIconInfo16(HICON16 hIcon, LPICONINFO16 iconinfo)
{
- ICONINFO ii32;
- BOOL16 ret = GetIconInfo(HICON_32(hIcon), &ii32);
+ CURSORICONINFO *info = get_icon_ptr( hIcon );
+ INT height;
+
+ if (!info) return FALSE;
+
+ if ((info->ptHotSpot.x == ICON_HOTSPOT) && (info->ptHotSpot.y == ICON_HOTSPOT))
+ {
+ iconinfo->fIcon = TRUE;
+ iconinfo->xHotspot = info->nWidth / 2;
+ iconinfo->yHotspot = info->nHeight / 2;
+ }
+ else
+ {
+ iconinfo->fIcon = FALSE;
+ iconinfo->xHotspot = info->ptHotSpot.x;
+ iconinfo->yHotspot = info->ptHotSpot.y;
+ }
- iconinfo->fIcon = ii32.fIcon;
- iconinfo->xHotspot = ii32.xHotspot;
- iconinfo->yHotspot = ii32.yHotspot;
- iconinfo->hbmMask = HBITMAP_16(ii32.hbmMask);
- iconinfo->hbmColor = HBITMAP_16(ii32.hbmColor);
- return ret;
+ height = info->nHeight;
+
+ if (info->bBitsPerPixel > 1)
+ {
+ iconinfo->hbmColor = HBITMAP_16( CreateBitmap( info->nWidth, info->nHeight,
+ info->bPlanes, info->bBitsPerPixel,
+ (char *)(info + 1)
+ + info->nHeight *
+ get_bitmap_width_bytes(info->nWidth,1) ));
+ }
+ else
+ {
+ iconinfo->hbmColor = 0;
+ height *= 2;
+ }
+
+ iconinfo->hbmMask = HBITMAP_16( CreateBitmap( info->nWidth, height, 1, 1, info + 1 ));
+ release_icon_ptr( hIcon, info );
+ return TRUE;
}
@@ -2167,7 +2197,6 @@ HICON16 WINAPI CreateIcon16( HINSTANCE16 hInstance, INT16 nWidth,
INT16 nHeight, BYTE bPlanes, BYTE bBitsPixel,
LPCVOID lpANDbits, LPCVOID lpXORbits )
{
- static const WORD ICON_HOTSPOT = 0x4242;
CURSORICONINFO info;
info.ptHotSpot.x = ICON_HOTSPOT;
More information about the wine-cvs
mailing list