a7f10517dc031407037d3e0996e6759dcfd8ec87
[reactos.git] / reactos / subsys / win32k / objects / fillshap.c
1
2 #undef WIN32_LEAN_AND_MEAN
3 #include <windows.h>
4 #include <ddk/ntddk.h>
5 #include <win32k/fillshap.h>
6 #include <win32k/dc.h>
7 #include <win32k/pen.h>
8 #include <include/object.h>
9
10 // #define NDEBUG
11 #include <win32k/debug1.h>
12
13 BOOL
14 STDCALL
15 W32kChord(HDC hDC,
16 int LeftRect,
17 int TopRect,
18 int RightRect,
19 int BottomRect,
20 int XRadial1,
21 int YRadial1,
22 int XRadial2,
23 int YRadial2)
24 {
25 UNIMPLEMENTED;
26 }
27
28 BOOL
29 STDCALL
30 W32kEllipse(HDC hDC,
31 int LeftRect,
32 int TopRect,
33 int RightRect,
34 int BottomRect)
35 {
36 UNIMPLEMENTED;
37 }
38
39 BOOL
40 STDCALL
41 W32kPie(HDC hDC,
42 int LeftRect,
43 int TopRect,
44 int RightRect,
45 int BottomRect,
46 int XRadial1,
47 int YRadial1,
48 int XRadial2,
49 int YRadial2)
50 {
51 UNIMPLEMENTED;
52 }
53
54 BOOL
55 STDCALL
56 W32kPolygon(HDC hDC,
57 CONST PPOINT Points,
58 int Count)
59 {
60 UNIMPLEMENTED;
61 }
62
63 BOOL
64 STDCALL
65 W32kPolyPolygon(HDC hDC,
66 CONST LPPOINT Points,
67 CONST LPINT PolyCounts,
68 int Count)
69 {
70 UNIMPLEMENTED;
71 }
72
73 BOOL
74 STDCALL
75 W32kRectangle(HDC hDC,
76 int LeftRect,
77 int TopRect,
78 int RightRect,
79 int BottomRect)
80 {
81 DC *dc = DC_HandleToPtr(hDC);
82 SURFOBJ *SurfObj = (SURFOBJ*)AccessUserObject((ULONG)dc->Surface);
83 PBRUSHOBJ BrushObj;
84 BOOL ret;
85 PRECTL RectBounds;
86 PENOBJ * pen;
87 RECTL DestRect;
88
89 if(!dc)
90 return FALSE;
91
92 RectBounds = GDIOBJ_LockObj(dc->w.hGCClipRgn, GO_REGION_MAGIC);
93 //ei not yet implemented ASSERT(RectBounds);
94
95 if(PATH_IsPathOpen(dc->w.path)) {
96 ret = PATH_Rectangle(hDC, LeftRect, TopRect, RightRect, BottomRect);
97 } else {
98 // Draw the rectangle with the current pen
99 pen = (PENOBJ*) GDIOBJ_LockObj(dc->w.hPen, GO_PEN_MAGIC);
100 ASSERT(pen);
101 BrushObj = (PBRUSHOBJ)PenToBrushObj(dc, pen);
102 GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC );
103
104 LeftRect += dc->w.DCOrgX;
105 RightRect += dc->w.DCOrgX;
106 TopRect += dc->w.DCOrgY;
107 BottomRect += dc->w.DCOrgY;
108
109 ret = EngLineTo(SurfObj,
110 NULL, // ClipObj,
111 BrushObj,
112 LeftRect, TopRect, RightRect, TopRect,
113 RectBounds, // Bounding rectangle
114 dc->w.ROPmode); // MIX
115
116 ret = EngLineTo(SurfObj,
117 NULL, // ClipObj,
118 BrushObj,
119 RightRect, TopRect, RightRect, BottomRect,
120 RectBounds, // Bounding rectangle
121 dc->w.ROPmode); // MIX
122
123 ret = EngLineTo(SurfObj,
124 NULL, // ClipObj,
125 BrushObj,
126 LeftRect, BottomRect, RightRect, BottomRect,
127 RectBounds, // Bounding rectangle
128 dc->w.ROPmode); // MIX
129
130 ret = EngLineTo(SurfObj,
131 NULL, // ClipObj,
132 BrushObj,
133 LeftRect, TopRect, LeftRect, BottomRect,
134 RectBounds, // Bounding rectangle
135 dc->w.ROPmode); // MIX */
136
137 BrushObj = (BRUSHOBJ*) GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
138 assert(BrushObj);
139 if (BrushObj->logbrush.lbStyle != BS_NULL)
140 {
141 DestRect.left = LeftRect + 1;
142 DestRect.right = RightRect - 1;
143 DestRect.top = TopRect + 1;
144 DestRect.bottom = BottomRect - 1;
145 ret = EngBitBlt(SurfObj,
146 NULL,
147 NULL,
148 NULL,
149 NULL,
150 &DestRect,
151 NULL,
152 NULL,
153 BrushObj,
154 NULL,
155 PATCOPY);
156 }
157 GDIOBJ_UnlockObj( dc->w.hBrush, GO_PEN_MAGIC );
158 }
159
160 // FIXME: Move current position in DC?
161 GDIOBJ_UnlockObj(dc->w.hGCClipRgn, GO_REGION_MAGIC);
162 DC_ReleasePtr( hDC );
163 return TRUE;
164 }
165
166 BOOL
167 STDCALL
168 W32kRoundRect(HDC hDC,
169 int LeftRect,
170 int TopRect,
171 int RightRect,
172 int BottomRect,
173 int Width,
174 int Height)
175 {
176 UNIMPLEMENTED;
177 }