Mike McCormack : comctl32: Create a helper function to copy a block of images.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 6 05:48:31 CST 2006


Module: wine
Branch: master
Commit: 7370fc0e700740bdbf2add987fdfc3150c7b00c2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7370fc0e700740bdbf2add987fdfc3150c7b00c2

Author: Mike McCormack <mike at codeweavers.com>
Date:   Sun Nov  5 14:04:50 2006 +0900

comctl32: Create a helper function to copy a block of images.

---

 dlls/comctl32/imagelist.c |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 5113054..58eac98 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -96,6 +96,18 @@ static inline void imagelist_get_bitmap_
     sz->cy = cy;
 }
 
+static inline void imagelist_copy_images( HIMAGELIST himl, HDC hdcSrc, HDC hdcDest,
+                                          UINT src, UINT count, UINT dest )
+{
+    POINT ptSrc, ptDest;
+    SIZE sz;
+
+    imagelist_point_from_index( himl, src, &ptSrc );
+    imagelist_point_from_index( himl, dest, &ptDest );
+    imagelist_get_bitmap_size( himl, count, himl->cy, &sz );
+    BitBlt (hdcDest, ptSrc.x, ptSrc.y, sz.cx, sz.cy, hdcSrc, ptDest.x, ptDest.y, SRCCOPY);
+}
+
 /*************************************************************************
  * IMAGELIST_InternalExpandBitmaps [Internal]
  *
@@ -2124,32 +2136,29 @@ ImageList_Remove (HIMAGELIST himl, INT i
 
         /* copy all images and masks prior to the "removed" image */
         if (i > 0) {
-            SIZE sz;
-
             TRACE("Pre image copy: Copy %d images\n", i);
 
             SelectObject (hdcBmp, hbmNewImage);
-            imagelist_get_bitmap_size( himl, i, himl->cy, &sz );
-            BitBlt (hdcBmp, 0, 0, sz.cx, sz.cy, himl->hdcImage, 0, 0, SRCCOPY);
+            imagelist_copy_images( himl, himl->hdcImage, hdcBmp, 0, i, 0 );
 
             if (himl->hbmMask) {
                 SelectObject (hdcBmp, hbmNewMask);
-                BitBlt (hdcBmp, 0, 0, sz.cx, sz.cy, himl->hdcMask, 0, 0, SRCCOPY);
+                imagelist_copy_images( himl, himl->hdcMask, hdcBmp, 0, i, 0 );
             }
         }
 
         /* copy all images and masks behind the removed image */
         if (i < himl->cCurImage - 1) {
             TRACE("Post image copy!\n");
+
             SelectObject (hdcBmp, hbmNewImage);
-            BitBlt (hdcBmp, i * himl->cx, 0, (himl->cCurImage - i - 1) * himl->cx,
-                      himl->cy, himl->hdcImage, (i + 1) * himl->cx, 0, SRCCOPY);
+            imagelist_copy_images( himl, himl->hdcImage, hdcBmp, i,
+                                   (himl->cCurImage - i - 1), i + 1 );
 
             if (himl->hbmMask) {
                 SelectObject (hdcBmp, hbmNewMask);
-                BitBlt (hdcBmp, i * himl->cx, 0,
-                          (himl->cCurImage - i - 1) * himl->cx,
-                          himl->cy, himl->hdcMask, (i + 1) * himl->cx, 0, SRCCOPY);
+                imagelist_copy_images( himl, himl->hdcMask, hdcBmp, i,
+                                       (himl->cCurImage - i - 1), i + 1 );
             }
         }
 




More information about the wine-cvs mailing list