branch update for HEAD-2003050101
[reactos.git] / subsys / win32k / objects / cliprgn.c
1
2
3 #undef WIN32_LEAN_AND_MEAN
4 #include <windows.h>
5 #include <ddk/ntddk.h>
6 #include <win32k/dc.h>
7 #include <win32k/region.h>
8 #include <win32k/cliprgn.h>
9 #include <win32k/coord.h>
10
11 #define NDEBUG
12 #include <win32k/debug1.h>
13
14 VOID
15 CLIPPING_UpdateGCRegion(DC* Dc)
16 {
17   if (Dc->w.hGCClipRgn == NULL)
18     {
19       Dc->w.hGCClipRgn = W32kCreateRectRgn(0, 0, 0, 0);
20     }
21
22   if (Dc->w.hClipRgn == NULL)
23     {
24       W32kCombineRgn(Dc->w.hGCClipRgn, Dc->w.hVisRgn, 0, RGN_COPY);
25     }
26   else
27     {
28       W32kCombineRgn(Dc->w.hGCClipRgn, Dc->w.hClipRgn, Dc->w.hVisRgn,
29                      RGN_AND);
30     }
31 }
32
33 HRGN WINAPI SaveVisRgn(HDC hdc)
34 {
35   HRGN copy;
36   PROSRGNDATA obj, copyObj;
37   PDC dc = DC_HandleToPtr(hdc);
38
39   if (!dc) return 0;
40
41   obj = RGNDATA_LockRgn(dc->w.hVisRgn);
42
43   if(!(copy = W32kCreateRectRgn(0, 0, 0, 0)))
44   {
45     RGNDATA_UnlockRgn(dc->w.hVisRgn);
46     DC_ReleasePtr(hdc);
47     return 0;
48   }
49   W32kCombineRgn(copy, dc->w.hVisRgn, 0, RGN_COPY);
50   copyObj = RGNDATA_LockRgn(copy);
51 /*  copyObj->header.hNext = obj->header.hNext;
52   header.hNext = copy; */
53
54   return copy;
55 }
56
57 INT STDCALL
58 W32kSelectVisRgn(HDC hdc, HRGN hrgn)
59 {
60   int retval;
61   DC *dc;
62
63   if (!hrgn)
64         return ERROR;
65   if (!(dc = DC_HandleToPtr(hdc)))
66         return ERROR;
67
68   dc->w.flags &= ~DC_DIRTY;
69
70   retval = W32kCombineRgn(dc->w.hVisRgn, hrgn, 0, RGN_COPY);
71   CLIPPING_UpdateGCRegion(dc);
72   DC_ReleasePtr( hdc );
73
74   return retval;
75 }
76
77 int STDCALL W32kExcludeClipRect(HDC  hDC,
78                          int  LeftRect,
79                          int  TopRect,
80                          int  RightRect,
81                          int  BottomRect)
82 {
83   UNIMPLEMENTED;
84 }
85
86 int STDCALL W32kExtSelectClipRgn(HDC  hDC,
87                           HRGN  hrgn,
88                           int  fnMode)
89 {
90   UNIMPLEMENTED;
91 }
92
93 int STDCALL W32kGetClipBox(HDC  hDC,
94                            LPRECT  rc)
95 {
96   int retval;
97   DC *dc;
98
99   if (!(dc = DC_HandleToPtr(hDC)))
100         return ERROR;
101   retval = UnsafeW32kGetRgnBox(dc->w.hGCClipRgn, rc);
102   rc->left -= dc->w.DCOrgX;
103   rc->right -= dc->w.DCOrgX;
104   rc->top -= dc->w.DCOrgY;
105   rc->bottom -= dc->w.DCOrgY;
106
107   DC_ReleasePtr( hDC );
108   W32kDPtoLP(hDC, (LPPOINT)rc, 2);
109   return(retval);
110 }
111
112 int STDCALL W32kGetMetaRgn(HDC  hDC,
113                     HRGN  hrgn)
114 {
115   UNIMPLEMENTED;
116 }
117
118 int STDCALL W32kIntersectClipRect(HDC  hDC,
119                            int  LeftRect,
120                            int  TopRect,
121                            int  RightRect,
122                            int  BottomRect)
123 {
124   UNIMPLEMENTED;
125 }
126
127 int STDCALL W32kOffsetClipRgn(HDC  hDC,
128                        int  XOffset,
129                        int  YOffset)
130 {
131   UNIMPLEMENTED;
132 }
133
134 BOOL STDCALL W32kPtVisible(HDC  hDC,
135                     int  X,
136                     int  Y)
137 {
138   UNIMPLEMENTED;
139 }
140
141 BOOL STDCALL W32kRectVisible(HDC  hDC,
142                       CONST PRECT  rc)
143 {
144   UNIMPLEMENTED;
145 }
146
147 BOOL STDCALL W32kSelectClipPath(HDC  hDC,
148                          int  Mode)
149 {
150   UNIMPLEMENTED;
151 }
152
153 int STDCALL W32kSelectClipRgn(HDC  hDC,
154                        HRGN  hrgn)
155 {
156   UNIMPLEMENTED;
157 }
158
159 int STDCALL W32kSetMetaRgn(HDC  hDC)
160 {
161   UNIMPLEMENTED;
162 }
163
164
165