Minor fixes
[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 // FIXME: BrushObj is obtained above; decide which one is correct
138 BrushObj = (BRUSHOBJ*) GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC);
139
140 if (BrushObj)
141 {
142 if (BrushObj->logbrush.lbStyle != BS_NULL)
143 {
144 DestRect.left = LeftRect + 1;
145 DestRect.right = RightRect - 1;
146 DestRect.top = TopRect + 1;
147 DestRect.bottom = BottomRect - 1;
148 ret = EngBitBlt(SurfObj,
149 NULL,
150 NULL,
151 NULL,
152 NULL,
153 &DestRect,
154 NULL,
155 NULL,
156 BrushObj,
157 NULL,
158 PATCOPY);
159 }
160 }
161 GDIOBJ_UnlockObj( dc->w.hBrush, GO_PEN_MAGIC );
162 }
163
164 // FIXME: Move current position in DC?
165 GDIOBJ_UnlockObj(dc->w.hGCClipRgn, GO_REGION_MAGIC);
166 DC_ReleasePtr( hDC );
167 return TRUE;
168 }
169
170 BOOL
171 STDCALL
172 W32kRoundRect(HDC hDC,
173 int LeftRect,
174 int TopRect,
175 int RightRect,
176 int BottomRect,
177 int Width,
178 int Height)
179 {
180 UNIMPLEMENTED;
181 }