Author: tkreuzer Date: Sat Dec 22 22:34:50 2012 New Revision: 57974
URL: http://svn.reactos.org/svn/reactos?rev=57974&view=rev Log: [WIN32K] Fix BRUSH_GetObject. Fixes 4 gdi32_apitests.
Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.c
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] Sat Dec 22 22:34:50 2012 @@ -142,57 +142,56 @@
INT FASTCALL -BRUSH_GetObject(PBRUSH pbrush, INT Count, LPLOGBRUSH Buffer) -{ - if (Buffer == NULL) return sizeof(LOGBRUSH); - if (Count == 0) return 0; +BRUSH_GetObject(PBRUSH pbrush, INT cjSize, LPLOGBRUSH plogbrush) +{ + /* Check if only size is requested */ + if (plogbrush == NULL) return sizeof(LOGBRUSH); + + /* Check if size is ok */ + if (cjSize == 0) return 0;
/* Set colour */ - Buffer->lbColor = pbrush->BrushAttr.lbColor; - - /* Set Hatch */ - if ((pbrush->flAttrs & BR_IS_HATCH)!=0) - { - /* FIXME: This is not the right value */ - Buffer->lbHatch = (LONG)pbrush->hbmPattern; + plogbrush->lbColor = pbrush->BrushAttr.lbColor; + + /* Default to 0 */ + plogbrush->lbHatch = 0; + + /* Get the type of style */ + if (pbrush->flAttrs & BR_IS_SOLID) + { + plogbrush->lbStyle = BS_SOLID; + } + else if (pbrush->flAttrs & BR_IS_NULL) + { + plogbrush->lbStyle = BS_NULL; // BS_HOLLOW + } + else if (pbrush->flAttrs & BR_IS_HATCH) + { + plogbrush->lbStyle = BS_HATCHED; + plogbrush->lbHatch = pbrush->ulStyle; + } + else if (pbrush->flAttrs & BR_IS_DIB) + { + plogbrush->lbStyle = BS_DIBPATTERN; + plogbrush->lbHatch = (ULONG_PTR)pbrush->hbmClient; + } + else if (pbrush->flAttrs & BR_IS_BITMAP) + { + plogbrush->lbStyle = BS_PATTERN; } else { - Buffer->lbHatch = 0; - } - - Buffer->lbStyle = 0; - - /* Get the type of style */ - if ((pbrush->flAttrs & BR_IS_SOLID)!=0) - { - Buffer->lbStyle = BS_SOLID; - } - else if ((pbrush->flAttrs & BR_IS_NULL)!=0) - { - Buffer->lbStyle = BS_NULL; // BS_HOLLOW - } - else if ((pbrush->flAttrs & BR_IS_HATCH)!=0) - { - Buffer->lbStyle = BS_HATCHED; - } - else if ((pbrush->flAttrs & BR_IS_BITMAP)!=0) - { - Buffer->lbStyle = BS_PATTERN; - } - else if ((pbrush->flAttrs & BR_IS_DIB)!=0) - { - Buffer->lbStyle = BS_DIBPATTERN; + plogbrush->lbStyle = 0; // ??? }
/* FIXME - else if ((pbrush->flAttrs & )!=0) - { - Buffer->lbStyle = BS_INDEXED; - } - else if ((pbrush->flAttrs & )!=0) - { - Buffer->lbStyle = BS_DIBPATTERNPT; + else if (pbrush->flAttrs & ) + { + plogbrush->lbStyle = BS_INDEXED; + } + else if (pbrush->flAttrs & ) + { + plogbrush->lbStyle = BS_DIBPATTERNPT; } */
@@ -245,6 +244,7 @@
pbrush->flAttrs |= BR_IS_BITMAP | BR_IS_DIB; pbrush->hbmPattern = hPattern; + pbrush->hbmClient = (HBITMAP)PackedDIB; /* FIXME: Fill in the rest of fields!!! */
GreSetObjectOwner(hPattern, GDI_OBJ_HMGR_PUBLIC);