Author: tkreuzer Date: Mon Dec 29 13:11:59 2014 New Revision: 65884
URL: http://svn.reactos.org/svn/reactos?rev=65884&view=rev Log: [WIN32K] - Implement NtGdiGetObjectBitmapHandle - Set BR_IS_DIBPALCOLORS in IntGdiCreateDIBBrush
Modified: trunk/reactos/win32ss/gdi/eng/stubs.c trunk/reactos/win32ss/gdi/ntgdi/brush.c
Modified: trunk/reactos/win32ss/gdi/eng/stubs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/stubs.c?rev... ============================================================================== --- trunk/reactos/win32ss/gdi/eng/stubs.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/stubs.c [iso-8859-1] Mon Dec 29 13:11:59 2014 @@ -923,18 +923,6 @@ return FALSE; }
-/* - * @unimplemented - */ -HBRUSH -APIENTRY -NtGdiClearBrushAttributes( - IN HBRUSH hbm, - IN DWORD dwFlags) -{ - UNIMPLEMENTED; - return NULL; -}
/* * @unimplemented @@ -1259,19 +1247,6 @@ /* * @unimplemented */ -HBITMAP -APIENTRY -NtGdiGetObjectBitmapHandle( - IN HBRUSH hbr, - OUT UINT *piUsage) -{ - UNIMPLEMENTED; - return 0; -} - -/* - * @unimplemented - */ BOOL APIENTRY NtGdiGetMonitorID( @@ -1408,19 +1383,6 @@ { UNIMPLEMENTED; return 0; -} - -/* - * @unimplemented - */ -HBRUSH -APIENTRY -NtGdiSetBrushAttributes( - IN HBRUSH hbm, - IN DWORD dwFlags) -{ - UNIMPLEMENTED; - return NULL; }
/*
Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.c?r... ============================================================================== --- trunk/reactos/win32ss/gdi/ntgdi/brush.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/ntgdi/brush.c [iso-8859-1] Mon Dec 29 13:11:59 2014 @@ -200,10 +200,10 @@ HBRUSH APIENTRY IntGdiCreateDIBBrush( - CONST BITMAPINFO *BitmapInfo, - UINT ColorSpec, + const BITMAPINFO *BitmapInfo, + UINT uUsage, UINT BitmapInfoSize, - CONST VOID *PackedDIB) + const VOID* pvClient) { HBRUSH hBrush; PBRUSH pbrush; @@ -217,9 +217,9 @@ return NULL; }
- DataPtr = (ULONG_PTR)BitmapInfo + DIB_BitmapInfoSize(BitmapInfo, ColorSpec); - - hPattern = DIB_CreateDIBSection(NULL, BitmapInfo, ColorSpec, &pvDIBits, NULL, 0, 0); + DataPtr = (ULONG_PTR)BitmapInfo + DIB_BitmapInfoSize(BitmapInfo, uUsage); + + hPattern = DIB_CreateDIBSection(NULL, BitmapInfo, uUsage, &pvDIBits, NULL, 0, 0); if (hPattern == NULL) { EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -241,8 +241,10 @@ hBrush = pbrush->BaseObject.hHmgr;
pbrush->flAttrs |= BR_IS_BITMAP | BR_IS_DIB; + if (uUsage == DIB_PAL_COLORS) + pbrush->flAttrs |= BR_IS_DIBPALCOLORS; pbrush->hbmPattern = hPattern; - pbrush->hbmClient = (HBITMAP)PackedDIB; + pbrush->hbmClient = (HBITMAP)pvClient; /* FIXME: Fill in the rest of fields!!! */
GreSetObjectOwner(hPattern, GDI_OBJ_HMGR_PUBLIC); @@ -460,5 +462,76 @@ return IntGdiCreateSolidBrush(Color); }
+HBITMAP +APIENTRY +NtGdiGetObjectBitmapHandle( + _In_ HBRUSH hbr, + _Out_ UINT *piUsage) +{ + HBITMAP hbmPattern; + PBRUSH pbr; + + /* Lock the brush */ + pbr = BRUSH_ShareLockBrush(hbr); + if (pbr == NULL) + { + DPRINT1("Could not lock brush\n"); + return NULL; + } + + /* Get the pattern bitmap handle */ + hbmPattern = pbr->hbmPattern; + + _SEH2_TRY + { + ProbeForWrite(piUsage, sizeof(*piUsage), sizeof(*piUsage)); + + /* Set usage according to flags */ + if (pbr->flAttrs & BR_IS_DIBPALCOLORS) + *piUsage = DIB_PAL_COLORS; + else + *piUsage = DIB_RGB_COLORS; + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + DPRINT1("Got exception!\n"); + hbmPattern = NULL; + } + _SEH2_END; + + /* Unlock the brush */ + BRUSH_ShareUnlockBrush(pbr); + + /* Return the pattern bitmap handle */ + return hbmPattern; +} + +/* + * @unimplemented + */ +HBRUSH +APIENTRY +NtGdiSetBrushAttributes( + IN HBRUSH hbm, + IN DWORD dwFlags) +{ + UNIMPLEMENTED; + return NULL; +} + + +/* + * @unimplemented + */ +HBRUSH +APIENTRY +NtGdiClearBrushAttributes( + IN HBRUSH hbr, + IN DWORD dwFlags) +{ + UNIMPLEMENTED; + return NULL; +} +
/* EOF */