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>
12 #include <include/inteng.h>
15 #include <win32k/debug1.h>
17 HBRUSH STDCALL W32kCreateBrushIndirect(CONST LOGBRUSH *lb)
22 hBrush = BRUSHOBJ_AllocBrush();
28 brushPtr = BRUSHOBJ_LockBrush (hBrush);
29 ASSERT( brushPtr ); //I want to know if this ever occurs
32 brushPtr->iSolidColor = lb->lbColor;
33 brushPtr->logbrush.lbStyle = lb->lbStyle;
34 brushPtr->logbrush.lbColor = lb->lbColor;
35 brushPtr->logbrush.lbHatch = lb->lbHatch;
37 BRUSHOBJ_UnlockBrush( hBrush );
43 HBRUSH STDCALL W32kCreateDIBPatternBrush(HGLOBAL hDIBPacked,
49 PBITMAPINFO info, newInfo;
52 DPRINT("%04x\n", hbitmap );
54 logbrush.lbStyle = BS_DIBPATTERN;
55 logbrush.lbColor = coloruse;
58 /* Make a copy of the bitmap */
59 if (!(info = (BITMAPINFO *)GlobalLock( hbitmap )))
65 if (info->bmiHeader.biCompression) size = info->bmiHeader.biSizeImage;
67 size = DIB_GetDIBImageBytes(info->bmiHeader.biWidth, info->bmiHeader.biHeight, info->bmiHeader.biBitCount);
68 size += DIB_BitmapInfoSize(info, coloruse);
70 if (!(logbrush.lbHatch = (INT)GlobalAlloc16( GMEM_MOVEABLE, size )))
72 GlobalUnlock16( hbitmap );
75 newInfo = (BITMAPINFO *) GlobalLock16((HGLOBAL16)logbrush.lbHatch);
76 memcpy(newInfo, info, size);
77 GlobalUnlock16((HGLOBAL16)logbrush.lbHatch);
78 GlobalUnlock(hbitmap);
79 return W32kCreateBrushIndirect(&logbrush);
83 HBRUSH STDCALL W32kCreateDIBPatternBrushPt(CONST VOID *PackedDIB,
91 info = (BITMAPINFO *) PackedDIB;
96 DPRINT ("%p %ldx%ld %dbpp\n",
98 info->bmiHeader.biWidth,
99 info->bmiHeader.biHeight,
100 info->bmiHeader.biBitCount);
102 logbrush.lbStyle = BS_DIBPATTERN;
103 logbrush.lbColor = Usage;
104 logbrush.lbHatch = 0;
106 /* Make a copy of the bitmap */
108 if (info->bmiHeader.biCompression)
110 size = info->bmiHeader.biSizeImage;
114 size = DIB_GetDIBImageBytes (info->bmiHeader.biWidth, info->bmiHeader.biHeight, info->bmiHeader.biBitCount);
116 size += DIB_BitmapInfoSize (info, Usage);
118 logbrush.lbHatch = (LONG) GDIOBJ_AllocObj(size, GO_MAGIC_DONTCARE);
119 if (logbrush.lbHatch == 0)
123 newInfo = (PBITMAPINFO) GDIOBJ_LockObj ((HGDIOBJ) logbrush.lbHatch, GO_MAGIC_DONTCARE);
125 memcpy(newInfo, info, size);
126 GDIOBJ_UnlockObj( (HGDIOBJ) logbrush.lbHatch, GO_MAGIC_DONTCARE );
128 return W32kCreateBrushIndirect (&logbrush);
131 HBRUSH STDCALL W32kCreateHatchBrush(INT Style,
136 DPRINT("%d %06lx\n", Style, Color);
138 if (Style < 0 || Style >= NB_HATCH_STYLES)
142 logbrush.lbStyle = BS_HATCHED;
143 logbrush.lbColor = Color;
144 logbrush.lbHatch = Style;
146 return W32kCreateBrushIndirect (&logbrush);
149 HBRUSH STDCALL W32kCreatePatternBrush(HBITMAP hBitmap)
151 LOGBRUSH logbrush = { BS_PATTERN, 0, 0 };
153 DPRINT ("%04x\n", hBitmap);
154 logbrush.lbHatch = (INT) BITMAPOBJ_CopyBitmap (hBitmap);
155 if(!logbrush.lbHatch)
161 return W32kCreateBrushIndirect( &logbrush );
165 HBRUSH STDCALL W32kCreateSolidBrush(COLORREF Color)
169 logbrush.lbStyle = BS_SOLID;
170 logbrush.lbColor = Color;
171 logbrush.lbHatch = 0;
173 return W32kCreateBrushIndirect(&logbrush);
176 BOOL STDCALL W32kFixBrushOrgEx(VOID)
181 BOOL STDCALL W32kPatBlt(HDC hDC,
191 DC *dc = DC_HandleToPtr(hDC);
199 SurfObj = (SURFOBJ*)AccessUserObject((ULONG)dc->Surface);
201 BrushObj = (BRUSHOBJ*) GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
203 if (BrushObj->logbrush.lbStyle != BS_NULL)
207 DestRect.left = XLeft + dc->w.DCOrgX;
208 DestRect.right = XLeft + Width + dc->w.DCOrgX;
212 DestRect.left = XLeft + Width + dc->w.DCOrgX;
213 DestRect.right = XLeft + dc->w.DCOrgX;
217 DestRect.top = YLeft + dc->w.DCOrgY;
218 DestRect.bottom = YLeft + Height + dc->w.DCOrgY;
222 DestRect.top = YLeft + Height + dc->w.DCOrgY;
223 DestRect.bottom = YLeft + dc->w.DCOrgY;
225 ret = IntEngBitBlt(SurfObj,
237 GDIOBJ_UnlockObj( dc->w.hBrush, GO_BRUSH_MAGIC );
238 DC_ReleasePtr( hDC );
242 BOOL STDCALL W32kSetBrushOrgEx(HDC hDC,