diff --git a/reactos/lib/gdi32/misc/stubs.c b/reactos/lib/gdi32/misc/stubs.c index 96bb3a60e92..69261936a9f 100644 --- a/reactos/lib/gdi32/misc/stubs.c +++ b/reactos/lib/gdi32/misc/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.58 2004/04/25 16:06:20 weiden Exp $ +/* $Id: stubs.c,v 1.59 2004/04/25 16:40:39 weiden Exp $ * * reactos/lib/gdi32/misc/stubs.c * @@ -387,21 +387,6 @@ ResizePalette( return FALSE; } -/* - * @unimplemented - */ -int -STDCALL -ExtSelectClipRgn( - HDC a0, - HRGN a1, - int a2 - ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - /* * @unimplemented diff --git a/reactos/lib/gdi32/objects/clip.c b/reactos/lib/gdi32/objects/clip.c index 9ba8170b0aa..a67d178643b 100644 --- a/reactos/lib/gdi32/objects/clip.c +++ b/reactos/lib/gdi32/objects/clip.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: clip.c,v 1.6 2004/04/25 16:06:20 weiden Exp $ +/* $Id: clip.c,v 1.7 2004/04/25 16:40:39 weiden Exp $ * * PROJECT: ReactOS gdi32.dll * FILE: lib/gdi32/objects/clip.c @@ -70,3 +70,18 @@ ExcludeClipRect( { return NtGdiExcludeClipRect(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect); } + +/* + * @implemented + */ +int +STDCALL +ExtSelectClipRgn( + HDC hdc, + HRGN hrgn, + int fnMode + ) +{ + return NtGdiExtSelectClipRgn(hdc, hrgn, fnMode); +} + diff --git a/reactos/subsys/win32k/objects/cliprgn.c b/reactos/subsys/win32k/objects/cliprgn.c index 135c0b62f41..c87f800fcf9 100644 --- a/reactos/subsys/win32k/objects/cliprgn.c +++ b/reactos/subsys/win32k/objects/cliprgn.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: cliprgn.c,v 1.34 2004/04/25 16:06:20 weiden Exp $ */ +/* $Id: cliprgn.c,v 1.35 2004/04/25 16:40:39 weiden Exp $ */ #undef WIN32_LEAN_AND_MEAN #include @@ -153,7 +153,64 @@ int STDCALL NtGdiExtSelectClipRgn(HDC hDC, HRGN hrgn, int fnMode) { - UNIMPLEMENTED; + int retval; + DC *dc; + + if (!(dc = DC_LockDc(hDC))) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return ERROR; + } + + dc->w.flags &= ~DC_DIRTY; + + if (!hrgn) + { + if (fnMode == RGN_COPY) + { + NtGdiDeleteObject(dc->w.hGCClipRgn); + dc->w.hGCClipRgn = NULL; + } + else + { + DC_UnlockDc( hDC ); + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return ERROR; + } + } + else + { + if (!dc->w.hGCClipRgn) + { + PROSRGNDATA Rgn; + RECT rect; + if((Rgn = RGNDATA_LockRgn(dc->w.hVisRgn))) + { + UnsafeIntGetRgnBox(Rgn, &rect); + RGNDATA_UnlockRgn(dc->w.hVisRgn); + dc->w.hGCClipRgn = UnsafeIntCreateRectRgnIndirect(&rect); + } + else + { + dc->w.hGCClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + } + } + if(fnMode == RGN_COPY) + NtGdiCombineRgn(dc->w.hGCClipRgn, hrgn, 0, fnMode); + else + NtGdiCombineRgn(dc->w.hGCClipRgn, dc->w.hGCClipRgn, hrgn, fnMode); + } + + if (dc->w.hVisRgn == NULL) + { + dc->w.hVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + GDIOBJ_CopyOwnership(hDC, dc->w.hVisRgn); + } + + CLIPPING_UpdateGCRegion(dc); + DC_UnlockDc( hDC ); + + return retval; } int FASTCALL