Commit 4d1e49dc authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

- Fix ImageList_GetIcon to use ImageList_* functions for

completeness. - Tiny code cleanups. - Documentation updates.
parent e4ddd2ac
...@@ -22,13 +22,14 @@ ...@@ -22,13 +22,14 @@
* *
* TODO: * TODO:
* - Fix ImageList_DrawIndirect (rgbFg, rgbBk, dwRop). * - Fix ImageList_DrawIndirect (rgbFg, rgbBk, dwRop).
* - Fix ImageList_GetIcon.
* - Fix ImageList_SetFilter (undocumented). * - Fix ImageList_SetFilter (undocumented).
* BTW does anybody know anything about this function??? * BTW does anybody know anything about this function???
* - It removes 12 Bytes from the stack (3 Parameters). * - It removes 12 Bytes from the stack (3 Parameters).
* - First parameter SHOULD be a HIMAGELIST. * - First parameter SHOULD be a HIMAGELIST.
* - Second parameter COULD be an index????? * - Second parameter COULD be an index?????
* - Third parameter.... ????????????????????? * - Third parameter.... ?????????????????????
* - Add support for ILD_PRESERVEALPHA, ILD_SCALE, ILD_DPISCALE
* - Add support for ILS_GLOW, ILS_SHADOW, ILS_SATURATE, ILS_ALPHA
* *
* Comments: * Comments:
* - ImageList_Draw, ImageList_DrawEx and ImageList_GetIcon use * - ImageList_Draw, ImageList_DrawEx and ImageList_GetIcon use
...@@ -1526,10 +1527,7 @@ ImageList_EndDrag (void) ...@@ -1526,10 +1527,7 @@ ImageList_EndDrag (void)
COLORREF WINAPI COLORREF WINAPI
ImageList_GetBkColor (HIMAGELIST himl) ImageList_GetBkColor (HIMAGELIST himl)
{ {
if (himl == NULL) return himl ? himl->clrBk : CLR_NONE;
return CLR_NONE;
return himl->clrBk;
} }
...@@ -1600,50 +1598,38 @@ HICON WINAPI ...@@ -1600,50 +1598,38 @@ HICON WINAPI
ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle) ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle)
{ {
ICONINFO ii; ICONINFO ii;
HICON hIcon; HICON hIcon;
HBITMAP hOldSrcBitmap,hOldDstBitmap; HBITMAP hOldDstBitmap;
HDC hdcSrc, hdcDst; HDC hdcDst;
if ((himl == NULL) || (i < 0) || (i >= himl->cCurImage)) { if ((himl == NULL) || (i < 0) || (i >= himl->cCurImage)) return 0;
return 0;
}
hdcSrc = CreateCompatibleDC(0);
hdcDst = CreateCompatibleDC(0); hdcDst = CreateCompatibleDC(0);
ii.fIcon = TRUE; ii.fIcon = TRUE;
ii.hbmMask = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy);
/* draw mask*/ /* draw mask*/
ii.hbmMask = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy);
hOldDstBitmap = (HBITMAP)SelectObject (hdcDst, ii.hbmMask); hOldDstBitmap = (HBITMAP)SelectObject (hdcDst, ii.hbmMask);
if (himl->hbmMask) { ImageList_Draw(himl, i, hdcDst, 0, 0, ILD_MASK);
SelectObject (hdcSrc, himl->hbmMask);
BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
hdcSrc, i * himl->cx, 0, SRCCOPY);
}
else
PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS);
/* draw image*/ /* draw image*/
hOldSrcBitmap = (HBITMAP)SelectObject (hdcSrc, himl->hbmImage); SelectObject (hdcDst, himl->hbmImage);
ii.hbmColor = CreateCompatibleBitmap (hdcSrc, himl->cx, himl->cy); ii.hbmColor = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy);
SelectObject (hdcDst, ii.hbmColor); SelectObject (hdcDst, ii.hbmColor);
BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, ImageList_Draw(himl, i, hdcDst, 0, 0, fStyle);
hdcSrc, i * himl->cx, 0, SRCCOPY);
/* /*
* CreateIconIndirect requires us to deselect the bitmaps from * CreateIconIndirect requires us to deselect the bitmaps from
* the DCs before calling * the DCs before calling
*/ */
SelectObject(hdcSrc, hOldSrcBitmap);
SelectObject(hdcDst, hOldDstBitmap); SelectObject(hdcDst, hOldDstBitmap);
hIcon = CreateIconIndirect (&ii); hIcon = CreateIconIndirect (&ii);
DeleteDC (hdcSrc);
DeleteDC (hdcDst);
DeleteObject (ii.hbmMask); DeleteObject (ii.hbmMask);
DeleteObject (ii.hbmColor); DeleteObject (ii.hbmColor);
DeleteDC (hdcDst);
return hIcon; return hIcon;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment