diff --git a/reactos/dll/win32/user32/windows/bitmap.c b/reactos/dll/win32/user32/windows/bitmap.c index 17ff0d8b498..a3c6cf00e51 100644 --- a/reactos/dll/win32/user32/windows/bitmap.c +++ b/reactos/dll/win32/user32/windows/bitmap.c @@ -56,7 +56,7 @@ typedef struct #include "poppack.h" -/* forward declerations... actually in user32\windows\icon.c but usful here */ +/* forward declarations... actually in user32\windows\icon.c but useful here */ HICON ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot); CURSORICONDIRENTRY *CURSORICON_FindBestIcon( CURSORICONDIR *dir, int width, int height, int colors); CURSORICONDIRENTRY *CURSORICON_FindBestCursor( CURSORICONDIR *dir, int width, int height, int colors); @@ -265,7 +265,7 @@ LoadCursorIconImage( hIcon = CreateIconFromResourceEx((PBYTE)ResIcon, SizeofResource(hinst, hResInfo), Icon, 0x00030000, width, height, - fuLoad & (LR_DEFAULTCOLOR | LR_MONOCHROME)); + (fuLoad & (LR_DEFAULTSIZE | LR_SHARED)) | LR_DEFAULTCOLOR); if (hIcon && 0 != (fuLoad & LR_SHARED)) { diff --git a/reactos/dll/win32/user32/windows/icon.c b/reactos/dll/win32/user32/windows/icon.c index e6a32fd6cfd..49bec207748 100644 --- a/reactos/dll/win32/user32/windows/icon.c +++ b/reactos/dll/win32/user32/windows/icon.c @@ -98,13 +98,25 @@ ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cx BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer; BITMAPINFO *orgBIH = (BITMAPINFO *)IconImage; ICONINFO IconInfo; - PVOID XORImageData = ImageData; IconInfo.fIcon = FALSE; IconInfo.xHotspot = xHotspot; IconInfo.yHotspot = yHotspot; - /* Create a BITMAPINFO header for the monochrome part of the icon */ + /* Handle the color part of the cursor */ + if (IconImage->icHeader.biBitCount == 1) + { + IconInfo.hbmColor = (HBITMAP)0; + } + else + { + FIXME("loading %d bpp color cursor\n", IconImage->icHeader.biBitCount); + IconInfo.hbmColor = CreateDIBitmap(hDC, &IconImage->icHeader, CBM_INIT, + ImageData, (BITMAPINFO*)IconImage, + DIB_RGB_COLORS); + } + + /* Create a BITMAPINFO header for the monochrome part of the cursor */ bwBIH->bmiHeader.biBitCount = 1; bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth; bwBIH->bmiHeader.biHeight = IconImage->icHeader.biHeight; @@ -127,29 +139,13 @@ ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cx bwBIH->bmiColors[1].rgbRed = 0xff; bwBIH->bmiColors[1].rgbReserved = 0; - /* Load the AND bitmap */ + /* Load the monochrome bitmap */ IconInfo.hbmMask = CreateDIBitmap(hDC, &bwBIH->bmiHeader, 0, - XORImageData, bwBIH, DIB_RGB_COLORS); + ImageData, bwBIH, DIB_RGB_COLORS); if (IconInfo.hbmMask) { SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight, - XORImageData, orgBIH, DIB_RGB_COLORS); - } - - if (IconImage->icHeader.biBitCount == 1) - { - IconInfo.hbmColor = (HBITMAP)0; - } - else - { - /* Create the color part of the icon */ - IconInfo.hbmColor = CreateDIBitmap(hDC, &IconImage->icHeader, 0, - XORImageData, orgBIH, DIB_RGB_COLORS); - if (IconInfo.hbmColor) - { - SetDIBits(hDC, IconInfo.hbmColor, 0, IconImage->icHeader.biHeight, - XORImageData, orgBIH, DIB_RGB_COLORS); - } + ImageData, orgBIH, DIB_RGB_COLORS); } /* Create the icon based on everything we have so far */ diff --git a/reactos/subsystems/win32/win32k/eng/mouse.c b/reactos/subsystems/win32/win32k/eng/mouse.c index 24d866ba434..f722669697d 100644 --- a/reactos/subsystems/win32/win32k/eng/mouse.c +++ b/reactos/subsystems/win32/win32k/eng/mouse.c @@ -426,7 +426,8 @@ EngSetPointerShape( } else { - pgp->XlateObject = pxlo; + pgp->XlateObject = EngAllocMem(0, sizeof(XLATEOBJ), TAG_XLATEOBJ); + memcpy(pgp->XlateObject, pxlo, sizeof(XLATEOBJ)); } /* Create surface for saving the pixels under the cursor. */