[ros-diffs] [cfinck] 35034: Hack: Copy the toolbar image on our own instead of using CopyImage to hackfix the messed up toolbar graphics as it was done for previous releases.

cfinck at svn.reactos.org cfinck at svn.reactos.org
Sat Aug 2 15:02:43 CEST 2008


Author: cfinck
Date: Sat Aug  2 08:02:42 2008
New Revision: 35034

URL: http://svn.reactos.org/svn/reactos?rev=35034&view=rev
Log:
Hack: Copy the toolbar image on our own instead of using CopyImage to hackfix the messed up toolbar graphics as it was done for previous releases.

Modified:
    branches/ros-branch-0_3_6/reactos/dll/win32/comctl32/toolbar.c

Modified: branches/ros-branch-0_3_6/reactos/dll/win32/comctl32/toolbar.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-branch-0_3_6/reactos/dll/win32/comctl32/toolbar.c?rev=35034&r1=35033&r2=35034&view=diff
==============================================================================
--- branches/ros-branch-0_3_6/reactos/dll/win32/comctl32/toolbar.c [iso-8859-1] (original)
+++ branches/ros-branch-0_3_6/reactos/dll/win32/comctl32/toolbar.c [iso-8859-1] Sat Aug  2 08:02:42 2008
@@ -2665,7 +2665,33 @@
     TRACE("adding hInst=%p nID=%d nButtons=%d\n", bitmap->hInst, bitmap->nID, bitmap->nButtons);
     /* Add bitmaps to the default image list */
     if (bitmap->hInst == NULL)         /* a handle was passed */
-        hbmLoad = (HBITMAP)CopyImage(ULongToHandle(bitmap->nID), IMAGE_BITMAP, 0, 0, 0);
+    {
+        BITMAP  bmp;
+        HBITMAP hOldBitmapBitmap, hOldBitmapLoad;
+        HDC     hdcImage, hdcBitmap;
+
+        /* copy the bitmap before adding it so that the user's bitmap
+         * doesn't get modified.
+         */
+        GetObjectW ((HBITMAP)bitmap->nID, sizeof(BITMAP), (LPVOID)&bmp);
+
+        hdcImage  = CreateCompatibleDC(0);
+        hdcBitmap = CreateCompatibleDC(0);
+
+        /* create new bitmap */
+        hbmLoad = CreateBitmap (bmp.bmWidth, bmp.bmHeight, bmp.bmPlanes, bmp.bmBitsPixel, NULL);
+        hOldBitmapBitmap = SelectObject(hdcBitmap, (HBITMAP)bitmap->nID);
+        hOldBitmapLoad = SelectObject(hdcImage, hbmLoad);
+
+        /* Copy the user's image */
+        BitBlt (hdcImage, 0, 0, bmp.bmWidth, bmp.bmHeight,
+                hdcBitmap, 0, 0, SRCCOPY);
+
+        SelectObject (hdcImage, hOldBitmapLoad);
+        SelectObject (hdcBitmap, hOldBitmapBitmap);
+        DeleteDC (hdcImage);
+        DeleteDC (hdcBitmap);
+    }
     else
         hbmLoad = CreateMappedBitmap(bitmap->hInst, bitmap->nID, 0, NULL, 0);
 



More information about the Ros-diffs mailing list