2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #undef WIN32_LEAN_AND_MEAN
23 #include <ddk/ntddk.h>
24 #include <win32k/dc.h>
25 #include <win32k/region.h>
26 #include <win32k/cliprgn.h>
27 #include <win32k/coord.h>
28 #include <include/error.h>
29 #include "../eng/clip.h"
32 #include <win32k/debug1.h>
35 CLIPPING_UpdateGCRegion(DC* Dc)
38 PROSRGNDATA CombinedRegion;
41 if (Dc->w.hGCClipRgn == NULL)
43 Dc->w.hGCClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
46 if (Dc->w.hGCClipRgn == NULL)
49 if (Dc->w.hClipRgn == NULL)
51 NtGdiCombineRgn(Dc->w.hGCClipRgn, Dc->w.hVisRgn, 0, RGN_COPY);
55 NtGdiCombineRgn(Dc->w.hGCClipRgn, Dc->w.hClipRgn, Dc->w.hVisRgn,
60 Combined = NtGdiCreateRectRgn(0, 0, 0, 0);
61 ASSERT(NULL != Combined);
63 if (Dc->w.hClipRgn == NULL)
65 NtGdiCombineRgn(Combined, Dc->w.hVisRgn, 0, RGN_COPY);
69 NtGdiCombineRgn(Combined, Dc->w.hClipRgn, Dc->w.hVisRgn,
72 NtGdiOffsetRgn(Combined, Dc->w.DCOrgX, Dc->w.DCOrgY);
74 CombinedRegion = RGNDATA_LockRgn(Combined);
75 ASSERT(NULL != CombinedRegion);
77 if (NULL != Dc->CombinedClip)
79 IntEngDeleteClipRegion(Dc->CombinedClip);
82 Dc->CombinedClip = IntEngCreateClipRegion(CombinedRegion->rdh.nCount,
83 (PRECTL)CombinedRegion->Buffer,
84 CombinedRegion->rdh.rcBound);
85 ASSERT(NULL != Dc->CombinedClip);
87 RGNDATA_UnlockRgn(Combined);
88 NtGdiDeleteObject(Combined);
91 HRGN WINAPI SaveVisRgn(HDC hdc)
94 PROSRGNDATA obj, copyObj;
95 PDC dc = DC_LockDc(hdc);
99 obj = RGNDATA_LockRgn(dc->w.hVisRgn);
101 if(!(copy = NtGdiCreateRectRgn(0, 0, 0, 0)))
103 RGNDATA_UnlockRgn(dc->w.hVisRgn);
107 NtGdiCombineRgn(copy, dc->w.hVisRgn, 0, RGN_COPY);
108 copyObj = RGNDATA_LockRgn(copy);
109 /* copyObj->header.hNext = obj->header.hNext;
110 header.hNext = copy; */
116 NtGdiSelectVisRgn(HDC hdc, HRGN hrgn)
123 if (!(dc = DC_LockDc(hdc)))
126 dc->w.flags &= ~DC_DIRTY;
128 if (dc->w.hVisRgn == NULL)
130 dc->w.hVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
133 retval = NtGdiCombineRgn(dc->w.hVisRgn, hrgn, 0, RGN_COPY);
134 CLIPPING_UpdateGCRegion(dc);
140 int STDCALL NtGdiExcludeClipRect(HDC hDC,
149 int STDCALL NtGdiExtSelectClipRgn(HDC hDC,
156 int STDCALL NtGdiGetClipBox(HDC hDC,
162 if (!(dc = DC_LockDc(hDC)))
164 retval = UnsafeIntGetRgnBox(dc->w.hGCClipRgn, rc);
167 NtGdiDPtoLP(hDC, (LPPOINT)rc, 2);
171 int STDCALL NtGdiGetMetaRgn(HDC hDC,
177 int STDCALL NtGdiIntersectClipRect(HDC hDC,
186 int STDCALL NtGdiOffsetClipRgn(HDC hDC,
193 BOOL STDCALL NtGdiPtVisible(HDC hDC,
200 BOOL STDCALL NtGdiRectVisible(HDC hDC,
206 BOOL STDCALL NtGdiSelectClipPath(HDC hDC,
212 int STDCALL NtGdiSelectClipRgn(HDC hDC,
222 SetLastWin32Error(ERROR_INVALID_HANDLE);
228 Copy = NtGdiCreateRectRgn(0, 0, 0, 0);
234 Type = NtGdiCombineRgn(Copy, hRgn, 0, RGN_COPY);
237 NtGdiDeleteObject(Copy);
247 if (NULL != dc->w.hClipRgn)
249 NtGdiDeleteObject(dc->w.hClipRgn);
251 dc->w.hClipRgn = Copy;
252 CLIPPING_UpdateGCRegion(dc);
258 int STDCALL NtGdiSetMetaRgn(HDC hDC)