Author: fireball Date: Sat Jun 5 21:59:12 2010 New Revision: 47602
URL: http://svn.reactos.org/svn/reactos?rev=47602&view=rev Log: - Copy bitmap even if it can't be selected into the dc (e.g. when it's already selected into another DC) using already existing helper. Fixes mouse cursor icon problem.
Modified: branches/arwinss/reactos/dll/win32/user32/cursoricon.c
Modified: branches/arwinss/reactos/dll/win32/user32/cursoricon.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32... ============================================================================== --- branches/arwinss/reactos/dll/win32/user32/cursoricon.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/user32/cursoricon.c [iso-8859-1] Sat Jun 5 21:59:12 2010 @@ -104,6 +104,8 @@ 0, 0, { (DWORD_PTR)(__FILE__ ": IconCrst") } }; static CRITICAL_SECTION IconCrst = { &critsect_debug, -1, 0, 0, 0, 0 }; +static void stretch_blt_icon( HDC hdc_dst, int dst_x, int dst_y, int dst_width, int dst_height, + HBITMAP src, int width, int height );
/********************************************************************** @@ -294,21 +296,20 @@ */ static HBITMAP copy_bitmap( HBITMAP bitmap ) { - HDC src, dst; + HDC hdc; HBITMAP new_bitmap; BITMAP bmp;
if (!bitmap) return 0; if (!GetObjectW( bitmap, sizeof(bmp), &bmp )) return 0;
- src = CreateCompatibleDC( 0 ); - dst = CreateCompatibleDC( 0 ); - SelectObject( src, bitmap ); - new_bitmap = CreateCompatibleBitmap( src, bmp.bmWidth, bmp.bmHeight ); - SelectObject( dst, new_bitmap ); - BitBlt( dst, 0, 0, bmp.bmWidth, bmp.bmHeight, src, 0, 0, SRCCOPY ); - DeleteDC( dst ); - DeleteDC( src ); + hdc = CreateCompatibleDC( 0 ); + new_bitmap = CreateBitmap( bmp.bmWidth, bmp.bmHeight, + bmp.bmPlanes, bmp.bmBitsPixel, NULL); + SelectObject( hdc, new_bitmap ); + stretch_blt_icon( hdc, 0, 0, bmp.bmWidth, bmp.bmHeight, + bitmap, bmp.bmWidth, bmp.bmHeight ); + DeleteDC( hdc ); return new_bitmap; }