comctl32: Correctly handle the ImageList index in BeginDrag().

This commit is contained in:
Michael Stefaniuc 2014-10-07 00:59:32 +02:00 committed by Alexandre Julliard
parent cf8e3c9a11
commit 753de28cd5
1 changed files with 10 additions and 4 deletions

View File

@ -599,6 +599,7 @@ ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack,
INT dxHotspot, INT dyHotspot)
{
INT cx, cy;
POINT src, dst;
TRACE("(himlTrack=%p iTrack=%d dx=%d dy=%d)\n", himlTrack, iTrack,
dxHotspot, dyHotspot);
@ -606,6 +607,9 @@ ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack,
if (!is_valid(himlTrack))
return FALSE;
if (iTrack >= himlTrack->cCurImage)
return FALSE;
if (InternalDrag.himl)
ImageList_EndDrag ();
@ -622,10 +626,12 @@ ImageList_BeginDrag (HIMAGELIST himlTrack, INT iTrack,
InternalDrag.dyHotspot = dyHotspot;
/* copy image */
BitBlt (InternalDrag.himl->hdcImage, 0, 0, cx, cy, himlTrack->hdcImage, iTrack * cx, 0, SRCCOPY);
/* copy mask */
BitBlt (InternalDrag.himl->hdcMask, 0, 0, cx, cy, himlTrack->hdcMask, iTrack * cx, 0, SRCCOPY);
imagelist_point_from_index(InternalDrag.himl, 0, &dst);
imagelist_point_from_index(himlTrack, iTrack, &src);
BitBlt(InternalDrag.himl->hdcImage, dst.x, dst.y, cx, cy, himlTrack->hdcImage, src.x, src.y,
SRCCOPY);
BitBlt(InternalDrag.himl->hdcMask, dst.x, dst.y, cx, cy, himlTrack->hdcMask, src.x, src.y,
SRCCOPY);
InternalDrag.himl->cCurImage = 1;