Removed NtGdiGet/Set/GraphicsMode/PolyFillMode/MapMode, update all related files...
[reactos.git] / reactos / dll / win32 / gdi32 / objects / region.c
1 #include "precomp.h"
2
3
4 /*
5 * @implemented
6 */
7 int STDCALL
8 SelectClipRgn(
9 HDC hdc,
10 HRGN hrgn
11 )
12 {
13 return ExtSelectClipRgn(hdc, hrgn, RGN_COPY);
14 }
15
16
17 /*
18 * @implemented
19 */
20 int
21 STDCALL
22 GetClipRgn(
23 HDC hdc,
24 HRGN hrgn
25 )
26 {
27 return NtGdiGetRandomRgn(hdc, hrgn, 1);
28 }
29
30
31 HRGN
32 WINAPI
33 CreatePolygonRgn( const POINT * lppt, int cPoints, int fnPolyFillMode)
34 {
35 return (HRGN) NtGdiPolyPolyDraw( (HDC) fnPolyFillMode, (PPOINT) lppt, (PULONG) &cPoints, 1, GdiPolyPolyRgn);
36 }
37
38
39 HRGN
40 WINAPI
41 CreatePolyPolygonRgn( const POINT* lppt,
42 const INT* lpPolyCounts,
43 int nCount,
44 int fnPolyFillMode)
45 {
46 return (HRGN) NtGdiPolyPolyDraw( (HDC) fnPolyFillMode, (PPOINT) lppt, (PULONG) lpPolyCounts, (ULONG) nCount, GdiPolyPolyRgn );
47 }
48
49 HRGN
50 WINAPI
51 CreateEllipticRgnIndirect(
52 const RECT *prc
53 )
54 {
55 /* Notes if prc is NULL it will crash on All Windows NT I checked 2000/XP/VISTA */
56 return NtGdiCreateEllipticRgn(prc->left, prc->top, prc->right, prc->bottom);
57
58 }
59
60 HRGN
61 WINAPI
62 CreateRectRgn(int x1, int y1, int x2,int y2)
63 {
64 /* FIXME Some part need be done in user mode */
65 return NtGdiCreateRectRgn(x1,y1,x2,y2);
66 }
67
68
69 HRGN
70 WINAPI
71 CreateRectRgnIndirect(
72 const RECT *prc
73 )
74 {
75 /* Notes if prc is NULL it will crash on All Windows NT I checked 2000/XP/VISTA */
76 return CreateRectRgn(prc->left, prc->top, prc->right, prc->bottom);
77
78 }
79
80 /*
81 * I thought it was okay to have this in DeleteObject but~ Speed. (jt)
82 */
83 BOOL
84 FASTCALL
85 DeleteRegion( HRGN hRgn )
86 {
87 #if 0
88 PREGION_ATTR Rgn_Attr;
89
90 if ((GdiGetHandleUserData((HGDIOBJ) hRgn, (PVOID) &Rgn_Attr)) &&
91 ( Rgn_Attr != NULL ))
92 {
93 PTEB pTeb = NtCurrentTeb();
94 if (pTeb->Win32ThreadInfo != NULL)
95 {
96 if ((pTeb->GdiTebBatch.Offset + sizeof(GDIBSOBJECT)) <= GDIBATCHBUFSIZE)
97 {
98 PGDIBSOBJECT pgO = (PGDIBSOBJECT)(&pTeb->GdiTebBatch.Buffer[0] +
99 pTeb->GdiTebBatch.Offset);
100 pgO->gbHdr.Cmd = GdiBCDelRgn;
101 pgO->gbHdr.Size = sizeof(GDIBSOBJECT);
102 pgO->hgdiobj = (HGDIOBJ)hRgn;
103
104 pTeb->GdiTebBatch.Offset += sizeof(GDIBSOBJECT);
105 pTeb->GdiBatchCount++;
106 if (pTeb->GdiBatchCount >= GDI_BatchLimit) NtGdiFlush();
107 return TRUE;
108 }
109 }
110 }
111 #endif
112 return NtGdiDeleteObjectApp((HGDIOBJ) hRgn);
113 }
114
115 /*
116 * @implemented
117 */
118 HRGN
119 STDCALL
120 ExtCreateRegion(
121 CONST XFORM * lpXform,
122 DWORD nCount,
123 CONST RGNDATA * lpRgnData
124 )
125 {
126 if (lpRgnData)
127 {
128 if ((!lpXform) && (lpRgnData->rdh.nCount == 1))
129 {
130 PRECT pRect = (PRECT)&lpRgnData->Buffer[0];
131 return CreateRectRgn(pRect->left, pRect->top, pRect->right, pRect->bottom);
132 }
133 return NtGdiExtCreateRegion((LPXFORM) lpXform, nCount,(LPRGNDATA) lpRgnData);
134 }
135 SetLastError(ERROR_INVALID_PARAMETER);
136 return NULL;
137 }
138