5 #undef WIN32_LEAN_AND_MEAN
8 #include <win32k/bitmaps.h>
9 #include <win32k/brush.h>
10 //#include <win32k/debug.h>
11 #include <include/object.h>
14 #include <win32k/debug1.h>
16 HBRUSH STDCALL W32kCreateBrushIndirect(CONST LOGBRUSH *lb)
21 hBrush = BRUSHOBJ_AllocBrush();
27 brushPtr = BRUSHOBJ_LockBrush (hBrush);
28 ASSERT( brushPtr ); //I want to know if this ever occurs
31 brushPtr->iSolidColor = lb->lbColor;
32 brushPtr->logbrush.lbStyle = lb->lbStyle;
33 brushPtr->logbrush.lbColor = lb->lbColor;
34 brushPtr->logbrush.lbHatch = lb->lbHatch;
36 BRUSHOBJ_UnlockBrush( hBrush );
42 HBRUSH STDCALL W32kCreateDIBPatternBrush(HGLOBAL hDIBPacked,
48 PBITMAPINFO info, newInfo;
51 DPRINT("%04x\n", hbitmap );
53 logbrush.lbStyle = BS_DIBPATTERN;
54 logbrush.lbColor = coloruse;
57 /* Make a copy of the bitmap */
58 if (!(info = (BITMAPINFO *)GlobalLock( hbitmap )))
64 if (info->bmiHeader.biCompression) size = info->bmiHeader.biSizeImage;
66 size = DIB_GetDIBImageBytes(info->bmiHeader.biWidth, info->bmiHeader.biHeight, info->bmiHeader.biBitCount);
67 size += DIB_BitmapInfoSize(info, coloruse);
69 if (!(logbrush.lbHatch = (INT)GlobalAlloc16( GMEM_MOVEABLE, size )))
71 GlobalUnlock16( hbitmap );
74 newInfo = (BITMAPINFO *) GlobalLock16((HGLOBAL16)logbrush.lbHatch);
75 memcpy(newInfo, info, size);
76 GlobalUnlock16((HGLOBAL16)logbrush.lbHatch);
77 GlobalUnlock(hbitmap);
78 return W32kCreateBrushIndirect(&logbrush);
82 HBRUSH STDCALL W32kCreateDIBPatternBrushPt(CONST VOID *PackedDIB,
90 info = (BITMAPINFO *) PackedDIB;
95 DPRINT ("%p %ldx%ld %dbpp\n",
97 info->bmiHeader.biWidth,
98 info->bmiHeader.biHeight,
99 info->bmiHeader.biBitCount);
101 logbrush.lbStyle = BS_DIBPATTERN;
102 logbrush.lbColor = Usage;
103 logbrush.lbHatch = 0;
105 /* Make a copy of the bitmap */
107 if (info->bmiHeader.biCompression)
109 size = info->bmiHeader.biSizeImage;
113 size = DIB_GetDIBImageBytes (info->bmiHeader.biWidth, info->bmiHeader.biHeight, info->bmiHeader.biBitCount);
115 size += DIB_BitmapInfoSize (info, Usage);
117 logbrush.lbHatch = (LONG) GDIOBJ_AllocObj(size, GO_MAGIC_DONTCARE);
118 if (logbrush.lbHatch == 0)
122 newInfo = (PBITMAPINFO) GDIOBJ_LockObj ((HGDIOBJ) logbrush.lbHatch, GO_MAGIC_DONTCARE);
124 memcpy(newInfo, info, size);
125 GDIOBJ_UnlockObj( (HGDIOBJ) logbrush.lbHatch, GO_MAGIC_DONTCARE );
127 return W32kCreateBrushIndirect (&logbrush);
130 HBRUSH STDCALL W32kCreateHatchBrush(INT Style,
135 DPRINT("%d %06lx\n", Style, Color);
137 if (Style < 0 || Style >= NB_HATCH_STYLES)
141 logbrush.lbStyle = BS_HATCHED;
142 logbrush.lbColor = Color;
143 logbrush.lbHatch = Style;
145 return W32kCreateBrushIndirect (&logbrush);
148 HBRUSH STDCALL W32kCreatePatternBrush(HBITMAP hBitmap)
150 LOGBRUSH logbrush = { BS_PATTERN, 0, 0 };
152 DPRINT ("%04x\n", hBitmap);
153 logbrush.lbHatch = (INT) BITMAPOBJ_CopyBitmap (hBitmap);
154 if(!logbrush.lbHatch)
160 return W32kCreateBrushIndirect( &logbrush );
164 HBRUSH STDCALL W32kCreateSolidBrush(COLORREF Color)
168 logbrush.lbStyle = BS_SOLID;
169 logbrush.lbColor = Color;
170 logbrush.lbHatch = 0;
172 return W32kCreateBrushIndirect(&logbrush);
175 BOOL STDCALL W32kFixBrushOrgEx(VOID)
180 BOOL STDCALL W32kPatBlt(HDC hDC,
190 DC *dc = DC_HandleToPtr(hDC);
198 SurfObj = (SURFOBJ*)AccessUserObject((ULONG)dc->Surface);
200 BrushObj = (BRUSHOBJ*) GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
202 if (BrushObj->logbrush.lbStyle != BS_NULL)
206 DestRect.left = XLeft + dc->w.DCOrgX;
207 DestRect.right = XLeft + Width + dc->w.DCOrgX;
211 DestRect.left = XLeft + Width + dc->w.DCOrgX;
212 DestRect.right = XLeft + dc->w.DCOrgX;
216 DestRect.top = YLeft + dc->w.DCOrgY;
217 DestRect.bottom = YLeft + Height + dc->w.DCOrgY;
221 DestRect.top = YLeft + Height + dc->w.DCOrgY;
222 DestRect.bottom = YLeft + dc->w.DCOrgY;
224 ret = EngBitBlt(SurfObj,
236 GDIOBJ_UnlockObj( dc->w.hBrush, GO_BRUSH_MAGIC );
237 DC_ReleasePtr( hDC );
241 BOOL STDCALL W32kSetBrushOrgEx(HDC hDC,