- ICON_CreateCursorFromData should pass a header that fits to the bitmap data to SetDIBits to allow color conversion if necessary; create the color cursor if requested in the same function

- Winamp 2.95 now shows a custom cursor, but it's still surrounded by blackness, bug #4370
- Misc typo fixes, cleanup

svn path=/trunk/; revision=40510
This commit is contained in:
Gregor Schneider 2009-04-14 21:30:03 +00:00
parent fc069970e4
commit a49c40392b
2 changed files with 19 additions and 6 deletions

View file

@ -56,8 +56,7 @@ typedef struct
#include "poppack.h"
/*forward declerations... actualy in user32\windows\icon.c but usful here****/
HICON ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot);
/* forward declerations... actually in user32\windows\icon.c but usful 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);

View file

@ -94,9 +94,9 @@ ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDe
HICON
ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot)
{
/* FIXME - color cursors */
BYTE BitmapInfoBuffer[sizeof(BITMAPINFOHEADER) + 2 * sizeof(RGBQUAD)];
BITMAPINFO *bwBIH = (BITMAPINFO *)BitmapInfoBuffer;
BITMAPINFO *orgBIH = (BITMAPINFO *)IconImage;
ICONINFO IconInfo;
PVOID XORImageData = ImageData;
@ -104,7 +104,7 @@ ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cx
IconInfo.xHotspot = xHotspot;
IconInfo.yHotspot = yHotspot;
/* Create a BITMAPINFO header for the monocrome part of the icon */
/* Create a BITMAPINFO header for the monochrome part of the icon */
bwBIH->bmiHeader.biBitCount = 1;
bwBIH->bmiHeader.biWidth = IconImage->icHeader.biWidth;
bwBIH->bmiHeader.biHeight = IconImage->icHeader.biHeight;
@ -133,10 +133,24 @@ ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cx
if (IconInfo.hbmMask)
{
SetDIBits(hDC, IconInfo.hbmMask, 0, IconImage->icHeader.biHeight,
XORImageData, bwBIH, DIB_RGB_COLORS);
XORImageData, orgBIH, DIB_RGB_COLORS);
}
IconInfo.hbmColor = (HBITMAP)0;
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);
}
}
/* Create the icon based on everything we have so far */
return NtUserCreateCursorIconHandle(&IconInfo, FALSE);