Commit in reactos on MAIN
include/win32k/brush.h+2-21.14 -> 1.15
subsys/win32k/dib/dib16bpp.c+5-51.29 -> 1.30
                 /dib1bpp.c+8-81.24 -> 1.25
                 /dib24bpp.c+3-31.24 -> 1.25
                 /dib32bpp.c+3-31.24 -> 1.25
                 /dib8bpp.c+7-71.22 -> 1.23
subsys/win32k/eng/bitblt.c+13-21.51 -> 1.52
subsys/win32k/objects/bitmaps.c+10-31.69 -> 1.70
                     /brush.c+64-101.34 -> 1.35
                     /dc.c+8-21.128 -> 1.129
+123-45
10 modified files
1. implemented hatched brushes
2. fixed memory leak when deleting patterned brushes
3. use brush origin in dib code

reactos/include/win32k
brush.h 1.14 -> 1.15
diff -u -r1.14 -r1.15
--- brush.h	9 Apr 2004 20:03:11 -0000	1.14
+++ brush.h	25 Apr 2004 11:34:12 -0000	1.15
@@ -31,7 +31,7 @@
    ULONG ulBrushUnique;
    BRUSHATTR *pBrushAttr;
    BRUSHATTR BrushAttr;
-   ULONG Unknown30;
+   POINT ptOrigin;
    ULONG bCacheGrabbed;
    COLORREF crBack;
    COLORREF crFore;
@@ -66,7 +66,7 @@
 #define GDIBRUSH_IS_MASKING		0x8000 /* Pattern bitmap is used as transparent mask (?) */
 #define GDIBRUSH_CACHED_IS_SOLID	0x80000000 
 
-#define  BRUSHOBJ_AllocBrush() ((HBRUSH) GDIOBJ_AllocObj (sizeof(GDIBRUSHOBJ), GDI_OBJECT_TYPE_BRUSH, NULL))
+#define  BRUSHOBJ_AllocBrush() ((HBRUSH) GDIOBJ_AllocObj (sizeof(GDIBRUSHOBJ), GDI_OBJECT_TYPE_BRUSH, (GDICLEANUPPROC) Brush_InternalDelete))
 #define  BRUSHOBJ_FreeBrush(hBrush) GDIOBJ_FreeObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH, GDIOBJFLAG_DEFAULT)
 #define  BRUSHOBJ_LockBrush(hBrush) ((PGDIBRUSHOBJ)GDIOBJ_LockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
 #define  BRUSHOBJ_UnlockBrush(hBrush) GDIOBJ_UnlockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH)

reactos/subsys/win32k/dib
dib16bpp.c 1.29 -> 1.30
diff -u -r1.29 -r1.30
--- dib16bpp.c	9 Apr 2004 22:00:38 -0000	1.29
+++ dib16bpp.c	25 Apr 2004 11:34:12 -0000	1.30
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: dib16bpp.c,v 1.29 2004/04/09 22:00:38 navaraf Exp $ */
+/* $Id: dib16bpp.c,v 1.30 2004/04/25 11:34:12 weiden Exp $ */
 #undef WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <stdlib.h>
@@ -351,7 +351,7 @@
       SourceX = SourcePoint->x;
       
       if(UsesPattern)
-        PatternY = Y % PatternHeight;
+        PatternY = (Y + BrushOrigin.y) % PatternHeight;
       
       for (X = DestRect->left; X < RoundedRight; X += 2, DestBits++, SourceX += 2)
       {
@@ -365,8 +365,8 @@
 
          if (UsesPattern)
 	 {
-            Pattern = (DIB_1BPP_GetPixel(PatternObj, X % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack);
-            Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + 1) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
+            Pattern = (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack);
+            Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + 1) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
          }
 
          *DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);
@@ -383,7 +383,7 @@
 
          if (UsesPattern)
          {
-            Pattern = DIB_1BPP_GetPixel(PatternObj, X % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
+            Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
          }				
 
          DIB_16BPP_PutPixel(DestSurf, X, Y, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xFFFF);

reactos/subsys/win32k/dib
dib1bpp.c 1.24 -> 1.25
diff -u -r1.24 -r1.25
--- dib1bpp.c	9 Apr 2004 22:00:38 -0000	1.24
+++ dib1bpp.c	25 Apr 2004 11:34:12 -0000	1.25
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: dib1bpp.c,v 1.24 2004/04/09 22:00:38 navaraf Exp $ */
+/* $Id: dib1bpp.c,v 1.25 2004/04/25 11:34:12 weiden Exp $ */
 
 #undef WIN32_LEAN_AND_MEAN
 #include <windows.h>
@@ -423,7 +423,7 @@
          Y * DestSurf->lDelta);
 
       if(UsesPattern)
-        PatternY = Y % PatternHeight;
+        PatternY = (Y + BrushOrigin.y) % PatternHeight;
 
       X = DestRect->left;
       if (X & 31)
@@ -444,7 +444,7 @@
          {
             Pattern = 0;
             for (k = 31 - NoBits; k < NoBits; k++)
-               Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + k) % PatternWidth, PatternY) << (31 - k));
+               Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + k) % PatternWidth, PatternY) << (31 - k));
          }
 
          Dest = DIB_DoRop(Rop4, Dest, Source, Pattern);	    
@@ -478,10 +478,10 @@
             Pattern = 0;
             for (k = 0; k < 8; k++)
             {
-               Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + k) % PatternWidth, PatternY) << (7 - k));
-               Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + k + 8) % PatternWidth, PatternY) << (8 + (7 - k)));
-               Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + k + 16) % PatternWidth, PatternY) << (16 + (7 - k)));
-               Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + k + 24) % PatternWidth, PatternY) << (24 + (7 - k)));
+               Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + k) % PatternWidth, PatternY) << (7 - k));
+               Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + k + 8) % PatternWidth, PatternY) << (8 + (7 - k)));
+               Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + k + 16) % PatternWidth, PatternY) << (16 + (7 - k)));
+               Pattern |= (DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x + k + 24) % PatternWidth, PatternY) << (24 + (7 - k)));
             }
          }
 
@@ -503,7 +503,7 @@
 
             if (UsesPattern)
             {
-               Pattern = DIB_1BPP_GetPixel(PatternObj, X % PatternWidth, PatternY);
+               Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY);
             }
 
             DIB_1BPP_PutPixel(DestSurf, X, Y, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xF);

reactos/subsys/win32k/dib
dib24bpp.c 1.24 -> 1.25
diff -u -r1.24 -r1.25
--- dib24bpp.c	9 Apr 2004 22:00:38 -0000	1.24
+++ dib24bpp.c	25 Apr 2004 11:34:12 -0000	1.25
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: dib24bpp.c,v 1.24 2004/04/09 22:00:38 navaraf Exp $ */
+/* $Id: dib24bpp.c,v 1.25 2004/04/25 11:34:12 weiden Exp $ */
 #undef WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <stdlib.h>
@@ -319,7 +319,7 @@
       SourceX = SourcePoint->x;
       
       if(UsesPattern)
-        PatternY = Y % PatternHeight;
+        PatternY = (Y + BrushOrigin.y) % PatternHeight;
       
       for (X = DestRect->left; X < DestRect->right; X++, DestBits += 3, SourceX++)
       {
@@ -332,7 +332,7 @@
 
          if (UsesPattern)
 	 {
-            Pattern = DIB_1BPP_GetPixel(PatternObj, X % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
+            Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
          }
 
          Dest = DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xFFFFFF;

reactos/subsys/win32k/dib
dib32bpp.c 1.24 -> 1.25
diff -u -r1.24 -r1.25
--- dib32bpp.c	9 Apr 2004 22:00:38 -0000	1.24
+++ dib32bpp.c	25 Apr 2004 11:34:12 -0000	1.25
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: dib32bpp.c,v 1.24 2004/04/09 22:00:38 navaraf Exp $ */
+/* $Id: dib32bpp.c,v 1.25 2004/04/25 11:34:12 weiden Exp $ */
 #undef WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <stdlib.h>
@@ -370,7 +370,7 @@
       SourceX = SourcePoint->x;
       
       if(UsesPattern)
-        PatternY = Y % PatternHeight;
+        PatternY = (Y + BrushOrigin.y) % PatternHeight;
       
       for (X = DestRect->left; X < DestRect->right; X++, DestBits++, SourceX++)
       {
@@ -383,7 +383,7 @@
 
          if (UsesPattern)
 	 {
-            Pattern = DIB_1BPP_GetPixel(PatternObj, X % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
+            Pattern = DIB_1BPP_GetPixel(PatternObj, (X + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
          }
 
          *DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);

reactos/subsys/win32k/dib
dib8bpp.c 1.22 -> 1.23
diff -u -r1.22 -r1.23
--- dib8bpp.c	9 Apr 2004 22:00:38 -0000	1.22
+++ dib8bpp.c	25 Apr 2004 11:34:12 -0000	1.23
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: dib8bpp.c,v 1.22 2004/04/09 22:00:38 navaraf Exp $ */
+/* $Id: dib8bpp.c,v 1.23 2004/04/25 11:34:12 weiden Exp $ */
 #undef WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <stdlib.h>
@@ -343,7 +343,7 @@
       DestBits = (PULONG)(DestSurf->pvScan0 + DestRect->left + j * DestSurf->lDelta);
 
       if(UsesPattern)
-        PatternY = j % PatternHeight;
+        PatternY = (j + BrushOrigin.y) % PatternHeight;
 
       for (i = DestRect->left; i < RoundedRight; i += 4, DestBits++)
       {
@@ -358,10 +358,10 @@
 
          if (UsesPattern)
          {
-            Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
-            Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 1) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 8;
-            Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 2) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
-            Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + 3) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 24;
+            Pattern = DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
+            Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 1) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 8;
+            Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 2) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 16;
+            Pattern |= (DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x + 3) % PatternWidth, PatternY) ? GdiBrush->crFore : GdiBrush->crBack) << 24;
          }
          *DestBits = DIB_DoRop(Rop4, Dest, Source, Pattern);	    
       }
@@ -378,7 +378,7 @@
 
             if (UsesPattern)
             {
-               Pattern = DIB_1BPP_GetPixel(PatternObj, i % PatternWidth,PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
+               Pattern = DIB_1BPP_GetPixel(PatternObj, (i + BrushOrigin.x) % PatternWidth,PatternY) ? GdiBrush->crFore : GdiBrush->crBack;
             }
 
             DIB_8BPP_PutPixel(DestSurf, i, j, DIB_DoRop(Rop4, Dest, Source, Pattern) & 0xFFFF);

reactos/subsys/win32k/eng
bitblt.c 1.51 -> 1.52
diff -u -r1.51 -r1.52
--- bitblt.c	10 Apr 2004 00:58:14 -0000	1.51
+++ bitblt.c	25 Apr 2004 11:34:13 -0000	1.52
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: bitblt.c,v 1.51 2004/04/10 00:58:14 navaraf Exp $
+/* $Id: bitblt.c,v 1.52 2004/04/25 11:34:13 weiden Exp $
  *
  * COPYRIGHT:        See COPYING in the top level directory
  * PROJECT:          ReactOS kernel
@@ -371,6 +371,7 @@
   OutputRect.top = DestRect->top + Translate.y;
   OutputRect.bottom = DestRect->bottom + Translate.y;
   
+  #if 0
   if(BrushOrigin)
   {
     AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
@@ -378,6 +379,9 @@
   }
   else
     AdjustedBrushOrigin = Translate;
+  #else
+  AdjustedBrushOrigin = (BrushOrigin ? *BrushOrigin : Translate);
+  #endif
 
   if (NULL != OutputObj)
     {
@@ -738,7 +742,7 @@
   OutputRect.right = prclDest->right + Translate.x;
   OutputRect.top = prclDest->top + Translate.y;
   OutputRect.bottom = prclDest->bottom + Translate.y;
-
+#if 0
   if(BrushOrigin)
   {
     AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
@@ -746,6 +750,9 @@
   }
   else
     AdjustedBrushOrigin = Translate;
+#else
+  AdjustedBrushOrigin = (BrushOrigin ? *BrushOrigin : Translate);
+#endif
 
   if (NULL != OutputObj)
     {
@@ -1134,6 +1141,7 @@
   OutputRect.top = DestRect->top + Translate.y;
   OutputRect.bottom = DestRect->bottom + Translate.y;
 
+#if 0
   if(BrushOrigin)
   {
     AdjustedBrushOrigin.x = BrushOrigin->x + Translate.x;
@@ -1141,6 +1149,9 @@
   }
   else
     AdjustedBrushOrigin = Translate;
+#else
+  AdjustedBrushOrigin = (BrushOrigin ? *BrushOrigin : Translate);
+#endif
 
   if (NULL != OutputObj)
     {

reactos/subsys/win32k/objects
bitmaps.c 1.69 -> 1.70
diff -u -r1.69 -r1.70
--- bitmaps.c	9 Apr 2004 20:03:20 -0000	1.69
+++ bitmaps.c	25 Apr 2004 11:34:13 -0000	1.70
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: bitmaps.c,v 1.69 2004/04/09 20:03:20 navaraf Exp $ */
+/* $Id: bitmaps.c,v 1.70 2004/04/25 11:34:13 weiden Exp $ */
 #undef WIN32_LEAN_AND_MEAN
 #include <windows.h>
 #include <stdlib.h>
@@ -56,7 +56,7 @@
 	SURFOBJ *SurfDest, *SurfSrc;
 	PSURFGDI SurfGDIDest, SurfGDISrc;
 	RECTL DestRect;
-	POINTL SourcePoint;
+	POINTL SourcePoint, BrushOrigin;
 	BOOL Status;
 	PPALGDI PalDestGDI, PalSourceGDI;
 	XLATEOBJ *XlateObj = NULL;
@@ -114,6 +114,9 @@
 
 	SourcePoint.x = XSrc;
 	SourcePoint.y = YSrc;
+	
+	BrushOrigin.x = 0;
+	BrushOrigin.y = 0;
 
 	/* Determine surfaces to be used in the bitblt */
 	SurfDest = (SURFOBJ*)AccessUserObject((ULONG)DCDest->Surface);
@@ -142,6 +145,7 @@
 			SetLastWin32Error(ERROR_INVALID_HANDLE);
 			return FALSE;
 		}
+		BrushOrigin = BrushObj->ptOrigin;
 	}
 	else
 	{
@@ -244,7 +248,7 @@
 
 	/* Perform the bitblt operation */
 	Status = IntEngBitBlt(SurfDest, SurfSrc, NULL, DCDest->CombinedClip, XlateObj,
-		&DestRect, &SourcePoint, NULL, &BrushObj->BrushObject, NULL, ROP);
+		&DestRect, &SourcePoint, NULL, &BrushObj->BrushObject, &BrushOrigin, ROP);
 
 	EngDeleteXlate(XlateObj);
 	if (NULL != Mono)
@@ -1071,7 +1075,10 @@
 		return(FALSE);
 	OldBrush = NtGdiSelectObject(hDC, NewBrush);
 	if (OldBrush == NULL)
+	{
+		NtGdiDeleteObject(NewBrush);
 		return(FALSE);
+	}
 	NtGdiPatBlt(hDC, X, Y, 1, 1, PATCOPY);
 	NtGdiSelectObject(hDC, OldBrush);
 	NtGdiDeleteObject(NewBrush);

reactos/subsys/win32k/objects
brush.c 1.34 -> 1.35
diff -u -r1.34 -r1.35
--- brush.c	9 Apr 2004 20:03:20 -0000	1.34
+++ brush.c	25 Apr 2004 11:34:13 -0000	1.35
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: brush.c,v 1.34 2004/04/09 20:03:20 navaraf Exp $
+ * $Id: brush.c,v 1.35 2004/04/25 11:34:13 weiden Exp $
  */
 
 #undef WIN32_LEAN_AND_MEAN
@@ -33,12 +33,56 @@
 #define NDEBUG
 #include <win32k/debug1.h>
 
+static const USHORT HatchBrushes[NB_HATCH_STYLES][8] =
+{
+  {0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00}, /* HS_HORIZONTAL */
+  {0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}, /* HS_VERTICAL   */
+  {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}, /* HS_FDIAGONAL  */
+  {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}, /* HS_BDIAGONAL  */
+  {0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08}, /* HS_CROSS      */
+  {0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81}  /* HS_DIAGCROSS  */
+};
+
+BOOL FASTCALL
+Brush_InternalDelete( PGDIBRUSHOBJ pBrush )
+{
+  ASSERT(pBrush);
+  
+  if(pBrush->flAttrs & (GDIBRUSH_IS_HATCH | GDIBRUSH_IS_BITMAP))
+  {
+    ASSERT(pBrush->hbmPattern);
+    NtGdiDeleteObject(pBrush->hbmPattern);
+  }
+  
+  return TRUE;
+}
+
 HBRUSH FASTCALL
 IntGdiCreateBrushIndirect(PLOGBRUSH LogBrush)
 {
    PGDIBRUSHOBJ BrushObject;
    HBRUSH hBrush;
-  
+   HBITMAP hPattern;
+   
+   switch (LogBrush->lbStyle)
+   {
+     case BS_HATCHED:
+       if(!(hPattern = NtGdiCreateBitmap(8, 8, 1, 1, HatchBrushes[LogBrush->lbHatch])))
+       {
+         SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+         return NULL;
+       }
+       break;
+     
+     case BS_PATTERN:
+       if(!(hPattern = BITMAPOBJ_CopyBitmap((HBITMAP)LogBrush->lbHatch)))
+       {
+         SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);
+         return NULL;
+       }
+       break;
+   }
+   
    hBrush = BRUSHOBJ_AllocBrush();
    if (hBrush == NULL)
    {
@@ -51,22 +95,26 @@
    switch (LogBrush->lbStyle)
    {
       case BS_NULL:
-         BrushObject->flAttrs = GDIBRUSH_IS_NULL;
+         BrushObject->flAttrs |= GDIBRUSH_IS_NULL;
          break;
-      
-      /* FIXME */
-      case BS_HATCHED:
 
       case BS_SOLID:
-         BrushObject->flAttrs = GDIBRUSH_IS_SOLID;
+         BrushObject->flAttrs |= GDIBRUSH_IS_SOLID;
          BrushObject->BrushAttr.lbColor = LogBrush->lbColor & 0xFFFFFF;
          BrushObject->BrushObject.iSolidColor = BrushObject->BrushAttr.lbColor;
          /* FIXME: Fill in the rest of fields!!! */
          break;
 
+      case BS_HATCHED:
+         BrushObject->flAttrs |= GDIBRUSH_IS_HATCH;
+         BrushObject->hbmPattern = hPattern;
+         BrushObject->BrushAttr.lbColor = LogBrush->lbColor & 0xFFFFFF;
+         BrushObject->BrushObject.iSolidColor = 0xFFFFFFFF;
+         break;
+
       case BS_PATTERN:
-         BrushObject->flAttrs = GDIBRUSH_IS_BITMAP;
-         BrushObject->hbmPattern = BITMAPOBJ_CopyBitmap((HBITMAP)LogBrush->lbHatch);
+         BrushObject->flAttrs |= GDIBRUSH_IS_BITMAP;
+         BrushObject->hbmPattern = hPattern;
          BrushObject->BrushObject.iSolidColor = 0xFFFFFFFF;
          /* FIXME: Fill in the rest of fields!!! */
          break;
@@ -92,6 +140,7 @@
 {
    RECTL DestRect;
    SURFOBJ *SurfObj;
+   POINTL BrushOrigin;
    BOOL ret;
 
    SurfObj = (SURFOBJ *)AccessUserObject((ULONG)dc->Surface);
@@ -125,6 +174,9 @@
          DestRect.top = YLeft + Height + dc->w.DCOrgY + 1;
          DestRect.bottom = YLeft + dc->w.DCOrgY + 1;
       }
+      
+      BrushOrigin.x = BrushObj->ptOrigin.x + dc->w.DCOrgX;
+      BrushOrigin.y = BrushObj->ptOrigin.y + dc->w.DCOrgY;
 
       ret = IntEngBitBlt(
          SurfObj,
@@ -136,7 +188,7 @@
          NULL,
          NULL,
          &BrushObj->BrushObject,
-         NULL,
+         &BrushOrigin,
          ROP);
    }
 
@@ -221,7 +273,9 @@
    LOGBRUSH LogBrush;
 
    if (Style < 0 || Style >= NB_HATCH_STYLES)
+   {
       return 0;
+   }
 
    LogBrush.lbStyle = BS_HATCHED;
    LogBrush.lbColor = Color;

reactos/subsys/win32k/objects
dc.c 1.128 -> 1.129
diff -u -r1.128 -r1.129
--- dc.c	9 Apr 2004 20:03:20 -0000	1.128
+++ dc.c	25 Apr 2004 11:34:13 -0000	1.129
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: dc.c,v 1.128 2004/04/09 20:03:20 navaraf Exp $
+/* $Id: dc.c,v 1.129 2004/04/25 11:34:13 weiden Exp $
  *
  * DC.C - Device context functions
  *
@@ -1797,7 +1797,13 @@
                       brush->BrushObject.iSolidColor = 0xFFFFFFFF;
                     }
                   brush->crBack = XLATEOBJ_iXlate(XlateObj, dc->w.backgroundColor);
-                  brush->crFore = XLATEOBJ_iXlate(XlateObj, dc->w.textColor);
+                  brush->crFore = XLATEOBJ_iXlate(XlateObj, ((brush->flAttrs & GDIBRUSH_IS_HATCH) ? 
+                                                             brush->BrushAttr.lbColor : dc->w.textColor));
+                  /* according to the documentation of SetBrushOrgEx(), the origin is assigned to the
+                     next brush selected into the DC, so we should set it here */
+                  brush->ptOrigin.x = dc->w.brushOrgX;
+                  brush->ptOrigin.y = dc->w.brushOrgY;
+                  
                   BRUSHOBJ_UnlockBrush((HBRUSH) hGDIObj);
                   objOrg = (HGDIOBJ)dc->w.hBrush;
                   dc->w.hBrush = (HBRUSH) hGDIObj;
CVSspam 0.2.8