comctl32: Remove Nx1 assumptions in ImageList_GetIcon().

This commit is contained in:
Mike McCormack 2006-11-05 17:09:47 +09:00 committed by Alexandre Julliard
parent 1328ca572b
commit 9cd86dddf1
1 changed files with 5 additions and 2 deletions

View File

@ -1441,6 +1441,7 @@ ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle)
HICON hIcon; HICON hIcon;
HBITMAP hOldDstBitmap; HBITMAP hOldDstBitmap;
HDC hdcDst; HDC hdcDst;
POINT pt;
TRACE("%p %d %d\n", himl, i, fStyle); TRACE("%p %d %d\n", himl, i, fStyle);
if (!is_valid(himl) || (i < 0) || (i >= himl->cCurImage)) return NULL; if (!is_valid(himl) || (i < 0) || (i >= himl->cCurImage)) return NULL;
@ -1456,12 +1457,14 @@ ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle)
hdcDst = CreateCompatibleDC(0); hdcDst = CreateCompatibleDC(0);
imagelist_point_from_index( himl, i, &pt );
/* draw mask*/ /* draw mask*/
ii.hbmMask = CreateBitmap (himl->cx, himl->cy, 1, 1, NULL); ii.hbmMask = CreateBitmap (himl->cx, himl->cy, 1, 1, NULL);
hOldDstBitmap = SelectObject (hdcDst, ii.hbmMask); hOldDstBitmap = SelectObject (hdcDst, ii.hbmMask);
if (himl->hbmMask) { if (himl->hbmMask) {
BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
himl->hdcMask, i * himl->cx, 0, SRCCOPY); himl->hdcMask, pt.x, pt.y, SRCCOPY);
} }
else else
PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS); PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS);
@ -1469,7 +1472,7 @@ ImageList_GetIcon (HIMAGELIST himl, INT i, UINT fStyle)
/* draw image*/ /* draw image*/
SelectObject (hdcDst, ii.hbmColor); SelectObject (hdcDst, ii.hbmColor);
BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, BitBlt (hdcDst, 0, 0, himl->cx, himl->cy,
himl->hdcImage, i * himl->cx, 0, SRCCOPY); himl->hdcImage, pt.x, pt.y, SRCCOPY);
/* /*
* CreateIconIndirect requires us to deselect the bitmaps from * CreateIconIndirect requires us to deselect the bitmaps from