From 87c9cac62cdcf9b166e5172453d2378a6af608ad Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Wed, 20 Jun 2007 19:54:22 +0000 Subject: [PATCH] fixing regress of icon drawing copyimage are complete mess and have allot of bugs. I fixed tempary the icon drawing bug until I or some else got time rewriting copyimage image_load case here is known bugs 1. alpha icon does not working. 2. wrong background getting selected 3. and allot other thing. svn path=/trunk/; revision=27246 --- reactos/dll/win32/user32/windows/bitmap.c | 33 ++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/reactos/dll/win32/user32/windows/bitmap.c b/reactos/dll/win32/user32/windows/bitmap.c index 3124929186d..553addd9985 100644 --- a/reactos/dll/win32/user32/windows/bitmap.c +++ b/reactos/dll/win32/user32/windows/bitmap.c @@ -681,21 +681,46 @@ CopyImage( && bi->bmiColors[1].rgbReserved == 0); } } +/* else if (!monochrome) { monochrome = ds.dsBm.bmBitsPixel == 1; } - +*/ if (monochrome) { res = CreateBitmap(desiredx, desiredy, 1, 1, NULL); } else { - HDC screenDC = GetDC(NULL); - res = CreateCompatibleBitmap(screenDC, desiredx, desiredy); - ReleaseDC(NULL, screenDC); + /* FIXME This is a tempary fix until we found time to rewrite copyimage */ + //HDC screenDC = GetDC(NULL); hnd + + HBITMAP hOldBitmapBitmap, hOldBitmapLoad, hbmLoad; + HDC hdcImage, hdcBitmap; + + hdcImage = CreateCompatibleDC(0); + hdcBitmap = CreateCompatibleDC(0); + + hbmLoad = CreateBitmap (desiredx, desiredy, ds.dsBm.bmPlanes, ds.dsBm.bmBitsPixel, NULL); + hOldBitmapBitmap = SelectObject(hdcBitmap, (HBITMAP) hnd); + hOldBitmapLoad = SelectObject(hdcImage, hbmLoad); + + /* Copy the user's image */ + BitBlt (hdcImage, 0, 0, desiredx, desiredy, hdcBitmap, 0, 0, SRCCOPY); + + SelectObject (hdcImage, hOldBitmapLoad); + SelectObject (hdcBitmap, hOldBitmapBitmap); + DeleteDC (hdcImage); + DeleteDC (hdcBitmap); + + return hbmLoad; + + + //res = CreateCompatibleBitmap(screenDC, desiredx, desiredy); + //ReleaseDC(NULL, screenDC); } + } if (res)