Commit 753de28c authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

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