:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[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 WINAPI 
58 W32kSelectVisRgn(HDC hdc, HRGN hrgn)
59 {
60   int retval;
61   DC *dc;
62
63   if (!hrgn) return ERROR;
64   if (!(dc = DC_HandleToPtr(hdc))) return ERROR;
65
66   dc->w.flags &= ~DC_DIRTY;
67
68   retval = W32kCombineRgn(dc->w.hVisRgn, hrgn, 0, RGN_COPY);
69   CLIPPING_UpdateGCRegion(dc);
70
71   return retval;
72 }
73
74 int STDCALL W32kExcludeClipRect(HDC  hDC,
75                          int  LeftRect,
76                          int  TopRect,
77                          int  RightRect,
78                          int  BottomRect)
79 {
80   UNIMPLEMENTED;
81 }
82
83 int STDCALL W32kExtSelectClipRgn(HDC  hDC,
84                           HRGN  hrgn,
85                           int  fnMode)
86 {
87   UNIMPLEMENTED;
88 }
89
90 int STDCALL W32kGetClipBox(HDC  hDC,
91                            LPRECT  rc)
92 {
93   int retval;
94   DC *dc;
95
96   if (!(dc = DC_HandleToPtr(hDC))) return ERROR;
97   retval = UnsafeW32kGetRgnBox(dc->w.hGCClipRgn, rc);
98   rc->left -= dc->w.DCOrgX;
99   rc->right -= dc->w.DCOrgX;
100   rc->top -= dc->w.DCOrgY;
101   rc->bottom -= dc->w.DCOrgY;
102   W32kDPtoLP(hDC, (LPPOINT)rc, 2);
103   return(retval);
104 }
105
106 int STDCALL W32kGetMetaRgn(HDC  hDC,
107                     HRGN  hrgn)
108 {
109   UNIMPLEMENTED;
110 }
111
112 int STDCALL W32kIntersectClipRect(HDC  hDC,
113                            int  LeftRect,
114                            int  TopRect,
115                            int  RightRect,
116                            int  BottomRect)
117 {
118   UNIMPLEMENTED;
119 }
120
121 int STDCALL W32kOffsetClipRgn(HDC  hDC,
122                        int  XOffset,
123                        int  YOffset)
124 {
125   UNIMPLEMENTED;
126 }
127
128 BOOL STDCALL W32kPtVisible(HDC  hDC,
129                     int  X,
130                     int  Y)
131 {
132   UNIMPLEMENTED;
133 }
134
135 BOOL STDCALL W32kRectVisible(HDC  hDC,
136                       CONST PRECT  rc)
137 {
138   UNIMPLEMENTED;
139 }
140
141 BOOL STDCALL W32kSelectClipPath(HDC  hDC,
142                          int  Mode)
143 {
144   UNIMPLEMENTED;
145 }
146
147 int STDCALL W32kSelectClipRgn(HDC  hDC,
148                        HRGN  hrgn)
149 {
150   UNIMPLEMENTED;
151 }
152
153 int STDCALL W32kSetMetaRgn(HDC  hDC)
154 {
155   UNIMPLEMENTED;
156 }
157
158
159