[WIN32K]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 22 Dec 2012 22:34:50 +0000 (22:34 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 22 Dec 2012 22:34:50 +0000 (22:34 +0000)
Fix BRUSH_GetObject. Fixes 4 gdi32_apitests.

svn path=/trunk/; revision=57974

reactos/win32ss/gdi/ntgdi/brush.c

index b3a969c..ec40791 100644 (file)
@@ -142,57 +142,56 @@ BRUSH_Cleanup(PVOID ObjectBody)
 
 INT
 FASTCALL
-BRUSH_GetObject(PBRUSH pbrush, INT Count, LPLOGBRUSH Buffer)
+BRUSH_GetObject(PBRUSH pbrush, INT cjSize, LPLOGBRUSH plogbrush)
 {
-    if (Buffer == NULL) return sizeof(LOGBRUSH);
-    if (Count == 0) return 0;
+    /* Check if only size is requested */
+    if (plogbrush == NULL) return sizeof(LOGBRUSH);
 
-    /* Set colour */
-    Buffer->lbColor = pbrush->BrushAttr.lbColor;
+    /* Check if size is ok */
+    if (cjSize == 0) return 0;
 
-    /* Set Hatch */
-    if ((pbrush->flAttrs & BR_IS_HATCH)!=0)
-    {
-        /* FIXME: This is not the right value */
-        Buffer->lbHatch = (LONG)pbrush->hbmPattern;
-    }
-    else
-    {
-        Buffer->lbHatch = 0;
-    }
+    /* Set colour */
+    plogbrush->lbColor = pbrush->BrushAttr.lbColor;
 
-    Buffer->lbStyle = 0;
+    /* Default to 0 */
+    plogbrush->lbHatch = 0;
 
     /* Get the type of style */
-    if ((pbrush->flAttrs & BR_IS_SOLID)!=0)
+    if (pbrush->flAttrs & BR_IS_SOLID)
     {
-        Buffer->lbStyle = BS_SOLID;
+        plogbrush->lbStyle = BS_SOLID;
     }
-    else if ((pbrush->flAttrs & BR_IS_NULL)!=0)
+    else if (pbrush->flAttrs & BR_IS_NULL)
     {
-        Buffer->lbStyle = BS_NULL; // BS_HOLLOW
+        plogbrush->lbStyle = BS_NULL; // BS_HOLLOW
     }
-    else if ((pbrush->flAttrs & BR_IS_HATCH)!=0)
+    else if (pbrush->flAttrs & BR_IS_HATCH)
     {
-        Buffer->lbStyle = BS_HATCHED;
+        plogbrush->lbStyle = BS_HATCHED;
+        plogbrush->lbHatch = pbrush->ulStyle;
     }
-    else if ((pbrush->flAttrs & BR_IS_BITMAP)!=0)
+    else if (pbrush->flAttrs & BR_IS_DIB)
     {
-        Buffer->lbStyle = BS_PATTERN;
+        plogbrush->lbStyle = BS_DIBPATTERN;
+        plogbrush->lbHatch = (ULONG_PTR)pbrush->hbmClient;
     }
-    else if ((pbrush->flAttrs & BR_IS_DIB)!=0)
+    else if (pbrush->flAttrs & BR_IS_BITMAP)
+    {
+        plogbrush->lbStyle = BS_PATTERN;
+    }
+    else
     {
-        Buffer->lbStyle = BS_DIBPATTERN;
+        plogbrush->lbStyle = 0; // ???
     }
 
     /* FIXME
-    else if ((pbrush->flAttrs & )!=0)
+    else if (pbrush->flAttrs & )
     {
-        Buffer->lbStyle = BS_INDEXED;
+        plogbrush->lbStyle = BS_INDEXED;
     }
-    else if ((pbrush->flAttrs & )!=0)
+    else if (pbrush->flAttrs & )
     {
-        Buffer->lbStyle = BS_DIBPATTERNPT;
+        plogbrush->lbStyle = BS_DIBPATTERNPT;
     }
     */
 
@@ -245,6 +244,7 @@ IntGdiCreateDIBBrush(
 
     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);