Author: fireball Date: Sat Aug 8 15:31:14 2009 New Revision: 42512 URL: http://svn.reactos.org/svn/reactos?rev=42512&view=rev Log: - Create graphics engine bitmaps for backing DIB sections. Fixes displaying of desktop icons. Work in progress, freeing of DIB sections is not implemented yet.
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c branches/arwinss/reactos/include/psdk/ntrosgdi.h branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c?rev=42512&r1=42511&r2=42512&view=diff ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Sat Aug 8 15:31:14 2009 @@ -174,12 +174,22 @@ HBITMAP CDECL RosDrv_CreateDIBSection( NTDRV_PDEVICE *physDev, HBITMAP hbitmap, const BITMAPINFO *bmi, UINT usage ) { - UNIMPLEMENTED; - return 0; + DIBSECTION dib; + + GetObjectW( hbitmap, sizeof(dib), &dib ); + + return RosGdiCreateDIBSection(physDev->hKernelDC, hbitmap, bmi, usage, &dib); } BOOL CDECL RosDrv_DeleteBitmap( HBITMAP hbitmap ) { + DIBSECTION dib; + + if (GetObjectW( hbitmap, sizeof(dib), &dib ) == sizeof(dib)) + { + FIXME("TODO: Delete existing DIB section!\n"); + } + return RosGdiDeleteBitmap(hbitmap); } Modified: branches/arwinss/reactos/include/psdk/ntrosgdi.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/include/psdk/ntrosgdi.h?rev=42512&r1=42511&r2=42512&view=diff ============================================================================== --- branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] (original) +++ branches/arwinss/reactos/include/psdk/ntrosgdi.h [iso-8859-1] Sat Aug 8 15:31:14 2009 @@ -75,7 +75,7 @@ INT xSrc, INT ySrc, DWORD rop ); BOOL APIENTRY RosGdiCreateBitmap( HDC physDev, HBITMAP hBitmap, BITMAP *pBitmap, LPVOID bmBits ); HBITMAP APIENTRY RosGdiCreateDIBSection( HDC physDev, HBITMAP hbitmap, - const BITMAPINFO *bmi, UINT usage ); + const BITMAPINFO *bmi, UINT usage, DIBSECTION *dib ); BOOL APIENTRY RosGdiDeleteBitmap( HBITMAP hbitmap ); LONG APIENTRY RosGdiGetBitmapBits( HBITMAP hbitmap, void *buffer, LONG count ); INT APIENTRY RosGdiGetDIBits( HDC physDev, HBITMAP hbitmap, UINT startscan, UINT lines, Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c?rev=42512&r1=42511&r2=42512&view=diff ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/bitmap.c [iso-8859-1] Sat Aug 8 15:31:14 2009 @@ -103,10 +103,34 @@ } HBITMAP APIENTRY RosGdiCreateDIBSection( HDC physDev, HBITMAP hbitmap, - const BITMAPINFO *bmi, UINT usage ) -{ - UNIMPLEMENTED; - return 0; + const BITMAPINFO *bmi, UINT usage, DIBSECTION *dib ) +{ + SIZEL szSize; + ULONG ulFormat; + HBITMAP hbmDIB; + + /* Get DIB section size */ + szSize.cx = dib->dsBm.bmWidth; + szSize.cy = abs(dib->dsBm.bmHeight); + + /* Get its format */ + ulFormat = GrepBitmapFormat(dib->dsBmih.biBitCount * dib->dsBmih.biPlanes, + dib->dsBmih.biCompression); + + /* Create the bitmap */ + hbmDIB = GreCreateBitmap(szSize, + dib->dsBm.bmWidthBytes, ulFormat, + BMF_DONTCACHE | BMF_USERMEM | BMF_NOZEROINIT | + (dib->dsBmih.biHeight < 0 ? BMF_TOPDOWN : 0), + dib->dsBm.bmBits); + + /* Map handles */ + GDI_AddHandleMapping(hbmDIB, hbitmap); + + DPRINT("Created bitmap %x (user handle %x) for DIB section\n", hbmDIB, hbitmap); + + /* Return success */ + return hbitmap; } BOOL APIENTRY RosGdiDeleteBitmap( HBITMAP hbitmap ) Modified: branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db?rev=42512&r1=42511&r2=42512&view=diff ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/w32ksvc.db [iso-8859-1] Sat Aug 8 15:31:14 2009 @@ -2,7 +2,7 @@ RosGdiAlphaBlend 11 RosGdiBitBlt 9 RosGdiCreateBitmap 4 -RosGdiCreateDIBSection 4 +RosGdiCreateDIBSection 5 RosGdiDeleteBitmap 1 RosGdiGetBitmapBits 3 RosGdiGetDIBits 7