Author: tkreuzer Date: Mon Mar 17 17:17:48 2008 New Revision: 32713
URL: http://svn.reactos.org/svn/reactos?rev=3D32713&view=3Drev Log: - Set the BaseObject.hHmgr field in GDIOBJ_AllocObj - rename RGNDATA_ functions to REGION_ to have a consistent naming. - move REGION prototypes to region.h - rename REGION_AllocRgn to REGION_AllocRgnWithHandle and make it return a = pointer to a locked region. - rename UnsafeIntGetRgnBox to REGION_GetRgnBox - rename UnsafeIntRectInRegion to REGION_RectInRegion - remove UnsafeIntUnionRectWithRgn maco - implement REGION_SetRectRgn and call it from NtGdiSetRectRgn - reorder some parameters - remove REGION_CropRgn, use REGION_CropAndOffsetRegion instead - Implement UserShowCursor based on the code from NtUserCallOneParam and ca= ll it from inside the switch statement.
Modified: trunk/reactos/subsystems/win32/win32k/eng/engwindow.c trunk/reactos/subsystems/win32/win32k/include/cursoricon.h trunk/reactos/subsystems/win32/win32k/include/intgdi.h trunk/reactos/subsystems/win32/win32k/include/region.h trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c trunk/reactos/subsystems/win32/win32k/ntuser/misc.c trunk/reactos/subsystems/win32/win32k/ntuser/painting.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c trunk/reactos/subsystems/win32/win32k/objects/region.c
Modified: trunk/reactos/subsystems/win32/win32k/eng/engwindow.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/eng/engwindow.c?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/eng/engwindow.c (original) +++ trunk/reactos/subsystems/win32/win32k/eng/engwindow.c Mon Mar 17 17:17:= 48 2008 @@ -86,7 +86,7 @@ if (hVisRgn !=3D NULL) { NtGdiOffsetRgn(hVisRgn, Window->Wnd->ClientRect.left, Window->Wnd->Cli= entRect.top); - visRgn =3D RGNDATA_LockRgn(hVisRgn); + visRgn =3D REGION_LockRgn(hVisRgn); if (visRgn !=3D NULL) { if (visRgn->rdh.nCount > 0) @@ -107,7 +107,7 @@ } } } - RGNDATA_UnlockRgn(visRgn); + REGION_UnlockRgn(visRgn); } else {
Modified: trunk/reactos/subsystems/win32/win32k/include/cursoricon.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/include/cursoricon.h?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/include/cursoricon.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/cursoricon.h Mon Mar 17 1= 7:17:48 2008 @@ -77,6 +77,8 @@ INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFla= gs); PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon); =
+int NTAPI UserShowCursor(BOOL bShow); + #define IntGetSysCursorInfo(WinStaObj) \ (PSYSTEM_CURSORINFO)((WinStaObj)->SystemCursor) =
Modified: trunk/reactos/subsystems/win32/win32k/include/intgdi.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/include/intgdi.h?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/include/intgdi.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/intgdi.h Mon Mar 17 17:17= :48 2008 @@ -126,29 +126,6 @@ ULONG uVertex, PVOID pMesh, ULONG uMesh, ULONG ulMode); =
-/* Rgn functions */ - -int FASTCALL -IntGdiGetClipBox(HDC hDC, - LPRECT rc); - -INT -STDCALL -IntGdiSelectVisRgn(HDC hdc, - HRGN hrgn); - -HRGN FASTCALL REGION_CropRgn(HRGN hDst, HRGN hSrc, const PRECT lpRect, PPO= INT lpPt); -void FASTCALL REGION_UnionRectWithRegion(const RECT *rect, ROSRGNDATA *rgn= ); -INT FASTCALL UnsafeIntGetRgnBox(PROSRGNDATA Rgn, LPRECT pRect); -BOOL FASTCALL UnsafeIntRectInRegion(PROSRGNDATA Rgn, CONST LPRECT rc); -INT STDCALL IntGdiGetRgnBox(HRGN, LPRECT); - -#define UnsafeIntCreateRectRgnIndirect(prc) \ - NtGdiCreateRectRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom) - -#define UnsafeIntUnionRectWithRgn(rgndest, prc) \ - REGION_UnionRectWithRegion((prc), (rgndest)) - /* DC functions */ =
BOOL FASTCALL
Modified: trunk/reactos/subsystems/win32/win32k/include/region.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/include/region.h?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/include/region.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/region.h Mon Mar 17 17:17= :48 2008 @@ -21,13 +21,26 @@ =
/* Functions *************************************************************= *****/ =
-#define RGNDATA_FreeRgn(hRgn) GDIOBJ_FreeObj((HGDIOBJ)hRgn, GDI_OBJECT_T= YPE_REGION) -#define RGNDATA_LockRgn(hRgn) ((PROSRGNDATA)GDIOBJ_LockObj((HGDIOBJ)hRgn,= GDI_OBJECT_TYPE_REGION)) -#define RGNDATA_UnlockRgn(pRgn) GDIOBJ_UnlockObjByPtr((POBJ)pRgn) +#define REGION_FreeRgn(hRgn) GDIOBJ_FreeObj((HGDIOBJ)hRgn, GDI_OBJECT_TY= PE_REGION) +#define REGION_LockRgn(hRgn) ((PROSRGNDATA)GDIOBJ_LockObj((HGDIOBJ)hRgn, = GDI_OBJECT_TYPE_REGION)) +#define REGION_UnlockRgn(pRgn) GDIOBJ_UnlockObjByPtr((POBJ)pRgn) =
-HRGN FASTCALL RGNDATA_AllocRgn(INT n); -BOOL INTERNAL_CALL RGNDATA_Cleanup(PVOID ObjectBody); +PROSRGNDATA FASTCALL REGION_AllocRgnWithHandle(INT n); +VOID FASTCALL REGION_UnionRectWithRgn(ROSRGNDATA *rgn, CONST RECT *rect); +INT FASTCALL REGION_GetRgnBox(PROSRGNDATA Rgn, LPRECT pRect); +BOOL FASTCALL REGION_RectInRegion(PROSRGNDATA Rgn, CONST LPRECT rc); +BOOL FASTCALL REGION_CropAndOffsetRegion(PROSRGNDATA rgnDst, PROSRGNDATA r= gnSrc, const PRECT rect, const PPOINT off); +VOID FASTCALL REGION_SetRectRgn(PROSRGNDATA pRgn, INT LeftRect, INT TopRec= t, INT RightRect, INT BottomRect); +BOOL INTERNAL_CALL REGION_Cleanup(PVOID ObjectBody); + +INT STDCALL IntGdiGetRgnBox(HRGN, LPRECT); BOOL FASTCALL IntGdiPaintRgn(PDC, HRGN ); HRGN FASTCALL GdiCreatePolyPolygonRgn(CONST PPOINT, CONST PINT, INT, INT ); +int FASTCALL IntGdiGetClipBox(HDC hDC, LPRECT rc); +INT STDCALL IntGdiSelectVisRgn(HDC hdc, HRGN hrgn); + + +#define UnsafeIntCreateRectRgnIndirect(prc) \ + NtGdiCreateRectRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom) =
#endif /* not __WIN32K_REGION_H */
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/ntuser/cursoricon.c?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/cursoricon.c Mon Mar 17 17= :17:48 2008 @@ -1817,3 +1817,95 @@ UserLeave(); return Ret; } + +/* Called from NtUserCallOneParam with Routine ONEPARAM_ROUTINE_SHOWCURSOR + * User32 macro NtUserShowCursor */ +int +NTAPI +UserShowCursor(BOOL bShow) +{ + PWINSTATION_OBJECT WinSta =3D PsGetCurrentThreadWin32Thread()->Desktop= ->WindowStation; + PSYSTEM_CURSORINFO CurInfo; + + HDC Screen; + PDC dc; + HBITMAP dcbmp; + SURFOBJ *SurfObj; + BITMAPOBJ *BitmapObj; + GDIDEVICE *ppdev; + GDIPOINTER *pgp; + int showpointer=3D0; + + if(!(Screen =3D IntGetScreenDC())) + { + return showpointer; /* No mouse */ + } + + dc =3D DC_LockDc(Screen); + + if (!dc) + { + return showpointer; /* No mouse */ + } + + dcbmp =3D dc->w.hBitmap; + DC_UnlockDc(dc); + + BitmapObj =3D BITMAPOBJ_LockBitmap(dcbmp); + if ( !BitmapObj ) + { + BITMAPOBJ_UnlockBitmap(BitmapObj); + return showpointer; /* No Mouse */ + } + + SurfObj =3D &BitmapObj->SurfObj; + if (SurfObj =3D=3D NULL) + { + BITMAPOBJ_UnlockBitmap(BitmapObj); + return showpointer; /* No mouse */ + } + + ppdev =3D GDIDEV(SurfObj); + + if(ppdev =3D=3D NULL) + { + BITMAPOBJ_UnlockBitmap(BitmapObj); + return showpointer; /* No mouse */ + } + + pgp =3D &ppdev->Pointer; + + CurInfo =3D IntGetSysCursorInfo(WinSta); + + if (bShow =3D=3D FALSE) + { + pgp->ShowPointer--; + showpointer =3D pgp->ShowPointer; + + if (showpointer >=3D 0) + { + //ppdev->SafetyRemoveCount =3D 1; + //ppdev->SafetyRemoveLevel =3D 1; + EngMovePointer(SurfObj,-1,-1,NULL); + CurInfo->ShowingCursor =3D 0; + } + + } + else + { + pgp->ShowPointer++; + showpointer =3D pgp->ShowPointer; + + /* Show Cursor */ + if (showpointer < 0) + { + //ppdev->SafetyRemoveCount =3D 0; + //ppdev->SafetyRemoveLevel =3D 0; + EngMovePointer(SurfObj,-1,-1,NULL); + CurInfo->ShowingCursor =3D CURSOR_SHOWING; + } + } + + BITMAPOBJ_UnlockBitmap(BitmapObj); + return showpointer; +}
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/ntuser/misc.c?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c Mon Mar 17 17:17:48= 2008 @@ -145,103 +145,16 @@ DWORD Routine) { DECLARE_RETURN(DWORD); - PDC dc; =
DPRINT("Enter NtUserCallOneParam\n"); =
- - if (Routine =3D=3D ONEPARAM_ROUTINE_SHOWCURSOR) - { - PWINSTATION_OBJECT WinSta =3D PsGetCurrentThreadWin32Thread()->Deskt= op->WindowStation; - PSYSTEM_CURSORINFO CurInfo; - - HDC Screen; - HBITMAP dcbmp; - SURFOBJ *SurfObj; - BITMAPOBJ *BitmapObj; - GDIDEVICE *ppdev; - GDIPOINTER *pgp; - int showpointer=3D0; - - if(!(Screen =3D IntGetScreenDC())) - { - return showpointer; /* No mouse */ - } - - dc =3D DC_LockDc(Screen); - - if (!dc) - { - return showpointer; /* No mouse */ - } - - dcbmp =3D dc->w.hBitmap; - DC_UnlockDc(dc); - - BitmapObj =3D BITMAPOBJ_LockBitmap(dcbmp); - if ( !BitmapObj ) - { - BITMAPOBJ_UnlockBitmap(BitmapObj); - return showpointer; /* No Mouse */ - } - - SurfObj =3D &BitmapObj->SurfObj; - if (SurfObj =3D=3D NULL) - { - BITMAPOBJ_UnlockBitmap(BitmapObj); - return showpointer; /* No mouse */ - } - - ppdev =3D GDIDEV(SurfObj); - - if(ppdev =3D=3D NULL) - { - BITMAPOBJ_UnlockBitmap(BitmapObj); - return showpointer; /* No mouse */ - } - - pgp =3D &ppdev->Pointer; - - CurInfo =3D IntGetSysCursorInfo(WinSta); - - if (Param =3D=3D FALSE) - { - pgp->ShowPointer--; - showpointer =3D pgp->ShowPointer; - - if (showpointer >=3D 0) - { - //ppdev->SafetyRemoveCount =3D 1; - //ppdev->SafetyRemoveLevel =3D 1; - EngMovePointer(SurfObj,-1,-1,NULL); - CurInfo->ShowingCursor =3D 0; - } - - } - else - { - pgp->ShowPointer++; - showpointer =3D pgp->ShowPointer; - - /* Show Cursor */ - if (showpointer < 0) - { - //ppdev->SafetyRemoveCount =3D 0; - //ppdev->SafetyRemoveLevel =3D 0; - EngMovePointer(SurfObj,-1,-1,NULL); - CurInfo->ShowingCursor =3D CURSOR_SHOWING; - } - } - - BITMAPOBJ_UnlockBitmap(BitmapObj); - return showpointer; - } - - UserEnterExclusive(); =
switch(Routine) { + case ONEPARAM_ROUTINE_SHOWCURSOR: + RETURN( (DWORD)UserShowCursor((BOOL)Param) ); + case ONEPARAM_ROUTINE_GETDESKTOPMAPPING: { PW32THREADINFO ti;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/ntuser/painting.c?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c Mon Mar 17 17:1= 7:48 2008 @@ -816,11 +816,11 @@ if (Window->UpdateRegion !=3D NULL) { MsqDecPaintCountQueue(Window->MessageQueue); - Rgn =3D RGNDATA_LockRgn(Window->UpdateRegion); + Rgn =3D REGION_LockRgn(Window->UpdateRegion); if (NULL !=3D Rgn) { - UnsafeIntGetRgnBox(Rgn, &Ps.rcPaint); - RGNDATA_UnlockRgn(Rgn); + REGION_GetRgnBox(Rgn, &Ps.rcPaint); + REGION_UnlockRgn(Rgn); IntGdiIntersectRect(&Ps.rcPaint, &Ps.rcPaint, &Window->Wnd->Clien= tRect); if (! IntGdiIsEmptyRect(&Ps.rcPaint)) { @@ -1042,10 +1042,10 @@ } else { - RgnData =3D RGNDATA_LockRgn(Window->UpdateRegion); + RgnData =3D REGION_LockRgn(Window->UpdateRegion); ASSERT(RgnData !=3D NULL); - RegionType =3D UnsafeIntGetRgnBox(RgnData, &Rect); - RGNDATA_UnlockRgn(RgnData); + RegionType =3D REGION_GetRgnBox(RgnData, &Rect); + REGION_UnlockRgn(RgnData); =
if (RegionType !=3D ERROR && RegionType !=3D NULLREGION) IntGdiIntersectRect(&Rect, &Rect, &Window->Wnd->ClientRect);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/ntuser/window.c?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c Mon Mar 17 17:17:= 48 2008 @@ -4392,10 +4392,10 @@ /* Copy the region into hRgn */ NtGdiCombineRgn(hRgn, VisRgn, NULL, RGN_COPY); =
- if((pRgn =3D RGNDATA_LockRgn(hRgn))) + if((pRgn =3D REGION_LockRgn(hRgn))) { Ret =3D pRgn->rdh.iType; - RGNDATA_UnlockRgn(pRgn); + REGION_UnlockRgn(pRgn); } else Ret =3D ERROR; @@ -4431,11 +4431,11 @@ if(Window->WindowRegion && !(Wnd->Style & WS_MINIMIZE)) NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND); =
- if((pRgn =3D RGNDATA_LockRgn(VisRgn))) + if((pRgn =3D REGION_LockRgn(VisRgn))) { Ret =3D pRgn->rdh.iType; *Rect =3D pRgn->rdh.rcBound; - RGNDATA_UnlockRgn(pRgn); + REGION_UnlockRgn(pRgn); } else Ret =3D ERROR;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/ntuser/winpos.c?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c Mon Mar 17 17:17:= 48 2008 @@ -961,16 +961,16 @@ VisBefore =3D VIS_ComputeVisibleRegion(Window, FALSE, FALSE, TRUE= ); VisRgn =3D NULL; =
- if (VisBefore !=3D NULL && (VisRgn =3D (PROSRGNDATA)RGNDATA_LockR= gn(VisBefore)) && - UnsafeIntGetRgnBox(VisRgn, &TempRect) =3D=3D NULLREGION) - { - RGNDATA_UnlockRgn(VisRgn); + if (VisBefore !=3D NULL && (VisRgn =3D (PROSRGNDATA)REGION_LockRg= n(VisBefore)) && + REGION_GetRgnBox(VisRgn, &TempRect) =3D=3D NULLREGION) + { + REGION_UnlockRgn(VisRgn); NtGdiDeleteObject(VisBefore); VisBefore =3D NULL; } else if(VisRgn) { - RGNDATA_UnlockRgn(VisRgn); + REGION_UnlockRgn(VisRgn); NtGdiOffsetRgn(VisBefore, -Window->Wnd->WindowRect.left, -Wind= ow->Wnd->WindowRect.top); } } @@ -1111,16 +1111,16 @@ VisAfter =3D VIS_ComputeVisibleRegion(Window, FALSE, FALSE, TRUE); VisRgn =3D NULL; =
- if (VisAfter !=3D NULL && (VisRgn =3D (PROSRGNDATA)RGNDATA_LockRgn(V= isAfter)) && - UnsafeIntGetRgnBox(VisRgn, &TempRect) =3D=3D NULLREGION) - { - RGNDATA_UnlockRgn(VisRgn); + if (VisAfter !=3D NULL && (VisRgn =3D (PROSRGNDATA)REGION_LockRgn(Vi= sAfter)) && + REGION_GetRgnBox(VisRgn, &TempRect) =3D=3D NULLREGION) + { + REGION_UnlockRgn(VisRgn); NtGdiDeleteObject(VisAfter); VisAfter =3D NULL; } else if(VisRgn) { - RGNDATA_UnlockRgn(VisRgn); + REGION_UnlockRgn(VisRgn); NtGdiOffsetRgn(VisAfter, -Window->Wnd->WindowRect.left, -Window->= Wnd->WindowRect.top); } =
@@ -1149,12 +1149,15 @@ if (!(WinPos.flags & SWP_NOSIZE) && RgnType !=3D ERROR && RgnType !=3D NULLREGION) { + PROSRGNDATA pCopyRgn; RECT ORect =3D OldClientRect; RECT NRect =3D NewClientRect; IntGdiOffsetRect(&ORect, - OldWindowRect.left, - OldWindowRect= .top); IntGdiOffsetRect(&NRect, - NewWindowRect.left, - NewWindowRect= .top); IntGdiIntersectRect(&CopyRect, &ORect, &NRect); - REGION_CropRgn(CopyRgn, CopyRgn, &CopyRect, NULL); + pCopyRgn =3D REGION_LockRgn(CopyRgn); + REGION_CropAndOffsetRegion(pCopyRgn, pCopyRgn, &CopyRect, NULL= ); + REGION_UnlockRgn(pCopyRgn); } =
/* No use in copying bits which are in the update region. */ @@ -1170,11 +1173,11 @@ * there's nothing to copy. Also, it's no use copying bits onto * themselves. */ - if ((VisRgn =3D (PROSRGNDATA)RGNDATA_LockRgn(CopyRgn)) && - UnsafeIntGetRgnBox(VisRgn, &CopyRect) =3D=3D NULLREGION) + if ((VisRgn =3D (PROSRGNDATA)REGION_LockRgn(CopyRgn)) && + REGION_GetRgnBox(VisRgn, &CopyRect) =3D=3D NULLREGION) { /* Nothing to copy, clean up */ - RGNDATA_UnlockRgn(VisRgn); + REGION_UnlockRgn(VisRgn); NtGdiDeleteObject(CopyRgn); CopyRgn =3D NULL; } @@ -1183,7 +1186,7 @@ { if(VisRgn) { - RGNDATA_UnlockRgn(VisRgn); + REGION_UnlockRgn(VisRgn); } =
/* @@ -1210,7 +1213,7 @@ } else if(VisRgn) { - RGNDATA_UnlockRgn(VisRgn); + REGION_UnlockRgn(VisRgn); } } else
Modified: trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/objects/cliprgn.c?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c Mon Mar 17 17:1= 7:48 2008 @@ -37,7 +37,7 @@ NtGdiCombineRgn(Dc->w.hGCClipRgn, Dc->w.hClipRgn, Dc->w.hVisRgn, RGN= _AND); NtGdiOffsetRgn(Dc->w.hGCClipRgn, Dc->w.DCOrgX, Dc->w.DCOrgY); =
- if((CombinedRegion =3D RGNDATA_LockRgn(Dc->w.hGCClipRgn))) + if((CombinedRegion =3D REGION_LockRgn(Dc->w.hGCClipRgn))) { if (Dc->CombinedClip !=3D NULL) IntEngDeleteClipRegion(Dc->CombinedClip); @@ -47,13 +47,13 @@ (PRECTL)CombinedRegion->Buffer, (PRECTL)&CombinedRegion->rdh.rcBound); =
- RGNDATA_UnlockRgn(CombinedRegion); + REGION_UnlockRgn(CombinedRegion); } =
if ( NULL =3D=3D Dc->CombinedClip ) { - DPRINT1("IntEngCreateClipRegion() failed\n"); - return ERROR; + DPRINT1("IntEngCreateClipRegion() failed\n"); + return ERROR; } =
return NtGdiOffsetRgn(Dc->w.hGCClipRgn, -Dc->w.DCOrgX, -Dc->w.DCOrgY); @@ -126,10 +126,10 @@ { PROSRGNDATA Rgn; RECT rect; - if((Rgn =3D RGNDATA_LockRgn(dc->w.hVisRgn))) - { - UnsafeIntGetRgnBox(Rgn, &rect); - RGNDATA_UnlockRgn(Rgn); + if((Rgn =3D REGION_LockRgn(dc->w.hVisRgn))) + { + REGION_GetRgnBox(Rgn, &rect); + REGION_UnlockRgn(Rgn); dc->w.hClipRgn =3D UnsafeIntCreateRectRgnIndirect(&rect); } else @@ -181,13 +181,13 @@ return ERROR; } =
- if (!(Rgn =3D RGNDATA_LockRgn(dc->w.hGCClipRgn))) + if (!(Rgn =3D REGION_LockRgn(dc->w.hGCClipRgn))) { DC_UnlockDc(dc); return ERROR; } - retval =3D UnsafeIntGetRgnBox(Rgn, rc); - RGNDATA_UnlockRgn(Rgn); + retval =3D REGION_GetRgnBox(Rgn, rc); + REGION_UnlockRgn(Rgn); IntDPtoLP(dc, (LPPOINT)rc, 2); DC_UnlockDc(dc); =
@@ -418,11 +418,11 @@ =
if (dc->w.hGCClipRgn) { - if((Rgn =3D (PROSRGNDATA)RGNDATA_LockRgn(dc->w.hGCClipRgn))) + if((Rgn =3D (PROSRGNDATA)REGION_LockRgn(dc->w.hGCClipRgn))) { IntLPtoDP(dc, (LPPOINT)&Rect, 2); - Result =3D UnsafeIntRectInRegion(Rgn, &Rect); - RGNDATA_UnlockRgn(Rgn); + Result =3D REGION_RectInRegion(Rgn, &Rect); + REGION_UnlockRgn(Rgn); } } DC_UnlockDc(dc);
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/objects/gdiobj.c?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c Mon Mar 17 17:17= :48 2008 @@ -72,7 +72,7 @@ {1, sizeof(DC), TAG_DC, DC_Cleanup}, /* 01 DC= */ {1, 0, 0, NULL}, /* 02 UN= USED1 */ {1, 0, 0, NULL}, /* 03 UN= USED2 */ - {1, sizeof(ROSRGNDATA), TAG_REGION, RGNDATA_Cleanup}, /* 04 RG= N */ + {1, sizeof(ROSRGNDATA), TAG_REGION, REGION_Cleanup}, /* 04 RGN= */ {1, sizeof(BITMAPOBJ), TAG_SURFACE, BITMAP_Cleanup}, /* 05 SU= RFACE */ {0, sizeof(DC), TAG_CLIENTOBJ, GDI_CleanupDummy}, /* 06 CL= IENTOBJ: METADC,... FIXME: don't use DC struct */ {0, 0, TAG_PATH, NULL}, /* 07 PA= TH, unused */ @@ -537,6 +537,7 @@ _InterlockedIncrement(&W32Process->GDIObjects); } Handle =3D (HGDIOBJ)((Index & 0xFFFF) | (TypeInfo << GDI_E= NTRY_UPPER_SHIFT)); + newObject->hHmgr =3D Handle; =
DPRINT("GDIOBJ_AllocObj: 0x%x ob: 0x%x\n", Handle, newObje= ct); return Handle;
Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win3= 2k/objects/region.c?rev=3D32713&r1=3D32712&r2=3D32713&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- trunk/reactos/subsystems/win32/win32k/objects/region.c (original) +++ trunk/reactos/subsystems/win32/win32k/objects/region.c Mon Mar 17 17:17= :48 2008 @@ -465,7 +465,7 @@ { ROSRGNDATA *Data; =
- Data =3D RGNDATA_LockRgn(hRgn); + Data =3D REGION_LockRgn(hRgn); if (Data =3D=3D NULL) { DbgPrint("IntDumpRegion called with invalid region!\n"); @@ -480,7 +480,7 @@ Data->rdh.rcBound.bottom, Data->rdh.iType); =
- RGNDATA_UnlockRgn(Data); + REGION_UnlockRgn(Data); } #endif /* not NDEBUG */ =
@@ -564,14 +564,19 @@ /*********************************************************************** * REGION_CropAndOffsetRegion */ -static BOOL FASTCALL +BOOL FASTCALL REGION_CropAndOffsetRegion( - const PPOINT off, + PROSRGNDATA rgnDst, + PROSRGNDATA rgnSrc, const PRECT rect, - PROSRGNDATA rgnSrc, - PROSRGNDATA rgnDst -) -{ + const PPOINT offset +) +{ + POINT pt =3D {0,0}; + PPOINT off =3D offset; + + if (!off) off =3D &pt; + if (!rect) // just copy and offset { PRECT xrect; @@ -725,69 +730,6 @@ } EMPTY_REGION(rgnDst); return TRUE; -} - -/*! - * \param - * hSrc: Region to crop and offset. - * lpRect: Clipping rectangle. Can be NULL (no clipping). - * lpPt: Points to offset the cropped region. Can be NULL (no offset). - * - * hDst: Region to hold the result (a new region is created if it's 0). - * Allowed to be the same region as hSrc in which case everything - * will be done in place, with no memory reallocations. - * - * \return hDst if success, 0 otherwise. - */ -HRGN FASTCALL -REGION_CropRgn( - HRGN hDst, - HRGN hSrc, - const PRECT lpRect, - PPOINT lpPt -) -{ - PROSRGNDATA objSrc, rgnDst; - HRGN hRet =3D NULL; - POINT pt =3D { 0, 0 }; - - if (!hDst) - { - if ( !(hDst =3D RGNDATA_AllocRgn(1)) ) - { - return 0; - } - } - - rgnDst =3D RGNDATA_LockRgn(hDst); - if (rgnDst =3D=3D NULL) - { - return NULL; - } - - objSrc =3D RGNDATA_LockRgn(hSrc); - if (objSrc =3D=3D NULL) - { - RGNDATA_UnlockRgn(rgnDst); - return NULL; - } - if (!lpPt) - lpPt =3D &pt; - - if (REGION_CropAndOffsetRegion(lpPt, lpRect, objSrc, rgnDst) =3D=3D FA= LSE) - { - // ve failed cleanup and return - hRet =3D NULL; - } - else // ve are fine. unlock the correct pointer and return correct ha= ndle - { - hRet =3D hDst; - } - - RGNDATA_UnlockRgn(objSrc); - RGNDATA_UnlockRgn(rgnDst); - - return hRet; } =
=
@@ -1772,35 +1714,29 @@ HRGN htra, htrb; ROSRGNDATA *tra, *trb; =
- if (!(htra =3D RGNDATA_AllocRgn(sra->rdh.nCount + 1))) + // FIXME: don't use a handle + tra =3D REGION_AllocRgnWithHandle(sra->rdh.nCount + 1); + if (!tra ) + { return; - if (!(htrb =3D RGNDATA_AllocRgn(srb->rdh.nCount + 1))) - { + } + htra =3D tra->BaseObject.hHmgr; + + // FIXME: don't use a handle + trb =3D REGION_AllocRgnWithHandle(srb->rdh.nCount + 1); + if (!trb) + { + REGION_UnlockRgn(tra); NtGdiDeleteObject(htra); return; } - tra =3D RGNDATA_LockRgn(htra); - if (!tra ) - { - NtGdiDeleteObject(htra); - NtGdiDeleteObject(htrb); - return; - } - - trb =3D RGNDATA_LockRgn(htrb); - if (!trb) - { - RGNDATA_UnlockRgn(tra); - NtGdiDeleteObject(htra); - NtGdiDeleteObject(htrb); - return; - } + htrb =3D trb->BaseObject.hHmgr; =
REGION_SubtractRegion(tra, sra, srb); REGION_SubtractRegion(trb, srb, sra); REGION_UnionRegion(dr, tra, trb); - RGNDATA_UnlockRgn(tra); - RGNDATA_UnlockRgn(trb); + REGION_UnlockRgn(tra); + REGION_UnlockRgn(trb); =
NtGdiDeleteObject(htra); NtGdiDeleteObject(htrb); @@ -1811,10 +1747,10 @@ /*! * Adds a rectangle to a REGION */ -void FASTCALL -REGION_UnionRectWithRegion( - const RECT *rect, - ROSRGNDATA *rgn +VOID FASTCALL +REGION_UnionRectWithRgn( + ROSRGNDATA *rgn, + const RECT *rect ) { ROSRGNDATA region; @@ -1914,26 +1850,26 @@ PRECT rc; ULONG i; =
- if (!(srcObj =3D (PROSRGNDATA)RGNDATA_LockRgn(hSrc))) + if (!(srcObj =3D REGION_LockRgn(hSrc))) { return FALSE; } if (!REGION_NOT_EMPTY(srcObj)) { - RGNDATA_UnlockRgn(srcObj); + REGION_UnlockRgn(srcObj); return FALSE; } - if (!(destObj =3D (PROSRGNDATA)RGNDATA_LockRgn(hDest))) - { - RGNDATA_UnlockRgn(srcObj); + if (!(destObj =3D REGION_LockRgn(hDest))) + { + REGION_UnlockRgn(srcObj); return FALSE; } =
EMPTY_REGION(destObj); if (!REGION_CopyRegion(destObj, srcObj)) { - RGNDATA_UnlockRgn(destObj); - RGNDATA_UnlockRgn(srcObj); + REGION_UnlockRgn(destObj); + REGION_UnlockRgn(srcObj); return FALSE; } =
@@ -1942,8 +1878,8 @@ if (!REGION_CreateSimpleFrameRgn(destObj, x, y)) { EMPTY_REGION(destObj); - RGNDATA_UnlockRgn(destObj); - RGNDATA_UnlockRgn(srcObj); + REGION_UnlockRgn(destObj); + REGION_UnlockRgn(srcObj); return FALSE; } } @@ -2002,8 +1938,8 @@ REGION_SubtractRegion(destObj, srcObj, destObj); } =
- RGNDATA_UnlockRgn(destObj); - RGNDATA_UnlockRgn(srcObj); + REGION_UnlockRgn(destObj); + REGION_UnlockRgn(srcObj); return TRUE; } =
@@ -2039,11 +1975,11 @@ goto done; } =
- if ( !(srcObj =3D (PROSRGNDATA) RGNDATA_LockRgn(hSrc)) ) + if ( !(srcObj =3D REGION_LockRgn(hSrc)) ) goto done; - if ( !(destObj =3D (PROSRGNDATA) RGNDATA_LockRgn(hDest)) ) - { - RGNDATA_UnlockRgn(srcObj); + if ( !(destObj =3D REGION_LockRgn(hDest)) ) + { + REGION_UnlockRgn(srcObj); goto done; } EMPTY_REGION(destObj); @@ -2070,27 +2006,27 @@ tmpRect.bottom =3D tmp; } =
- REGION_UnionRectWithRegion(&tmpRect, destObj); + REGION_UnionRectWithRgn(destObj, &tmpRect); } ret =3D TRUE; =
- RGNDATA_UnlockRgn(srcObj); - RGNDATA_UnlockRgn(destObj); + REGION_UnlockRgn(srcObj); + REGION_UnlockRgn(destObj); =
done: DC_UnlockDc(dc); return ret; } =
-HRGN FASTCALL -RGNDATA_AllocRgn(INT n) +PROSRGNDATA FASTCALL +REGION_AllocRgnWithHandle(INT n) { HRGN hReg; PROSRGNDATA pReg; =
if ((hReg =3D (HRGN) GDIOBJ_AllocObj(GDI_OBJECT_TYPE_REGION))) { - if (NULL !=3D (pReg =3D RGNDATA_LockRgn(hReg))) + if (NULL !=3D (pReg =3D REGION_LockRgn(hReg))) { if (1 =3D=3D n) { @@ -2110,14 +2046,12 @@ pReg->rdh.nCount =3D n; pReg->rdh.nRgnSize =3D n*sizeof(RECT); =
- RGNDATA_UnlockRgn(pReg); - - return hReg; + return pReg; } } else { - RGNDATA_FreeRgn(hReg); + REGION_FreeRgn(hReg); } } =
@@ -2125,7 +2059,7 @@ } =
BOOL INTERNAL_CALL -RGNDATA_Cleanup(PVOID ObjectBody) +REGION_Cleanup(PVOID ObjectBody) { PROSRGNDATA pRgn =3D (PROSRGNDATA)ObjectBody; if (pRgn->Buffer && pRgn->Buffer !=3D &pRgn->rdh.rcBound) @@ -2144,10 +2078,10 @@ INT result =3D ERROR; PROSRGNDATA destRgn, src1Rgn, src2Rgn; =
- destRgn =3D RGNDATA_LockRgn(hDest); + destRgn =3D REGION_LockRgn(hDest); if (destRgn) { - src1Rgn =3D RGNDATA_LockRgn(hSrc1); + src1Rgn =3D REGION_LockRgn(hSrc1); if (src1Rgn) { if (CombineMode =3D=3D RGN_COPY) @@ -2158,7 +2092,7 @@ } else { - src2Rgn =3D RGNDATA_LockRgn(hSrc2); + src2Rgn =3D REGION_LockRgn(hSrc2); if (src2Rgn) { switch (CombineMode) @@ -2176,7 +2110,7 @@ REGION_SubtractRegion(destRgn, src1Rgn, src2Rgn); break; } - RGNDATA_UnlockRgn(src2Rgn); + REGION_UnlockRgn(src2Rgn); result =3D destRgn->rdh.iType; } else if (hSrc2 =3D=3D NULL) @@ -2185,10 +2119,10 @@ } } =
- RGNDATA_UnlockRgn(src1Rgn); - } - - RGNDATA_UnlockRgn(destRgn); + REGION_UnlockRgn(src1Rgn); + } + + REGION_UnlockRgn(destRgn); } else { @@ -2215,18 +2149,22 @@ HRGN STDCALL NtGdiCreateRectRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRec= t) { + PROSRGNDATA pRgn; HRGN hRgn; =
/* Allocate region data structure with space for 1 RECT */ - if ((hRgn =3D RGNDATA_AllocRgn(1))) - { - if (NtGdiSetRectRgn(hRgn, LeftRect, TopRect, RightRect, BottomRect= )) - return hRgn; - NtGdiDeleteObject(hRgn); - } - - SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); - return NULL; + if (!(pRgn =3D REGION_AllocRgnWithHandle(1))) + { + SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } + hRgn =3D pRgn->BaseObject.hHmgr; + + REGION_SetRectRgn(pRgn, LeftRect, TopRect, RightRect, BottomRect); + REGION_UnlockRgn(pRgn); + + return hRgn; + } =
HRGN @@ -2276,8 +2214,8 @@ /* Create region */ =
d =3D (ellipse_height < 128) ? ((3 * ellipse_height) >> 2) : 64; - if (!(hrgn =3D RGNDATA_AllocRgn(d))) return 0; - if (!(obj =3D RGNDATA_LockRgn(hrgn))) return 0; + if (!(obj =3D REGION_AllocRgnWithHandle(d))) return 0; + hrgn =3D obj->BaseObject.hHmgr; =
/* Ellipse algorithm, based on an article by K. Porter */ /* in DDJ Graphics Programming Column, 8/89 */ @@ -2300,10 +2238,10 @@ /* move toward center */ rect.top =3D top++; rect.bottom =3D rect.top + 1; - UnsafeIntUnionRectWithRgn(obj, &rect); + REGION_UnionRectWithRgn(obj, &rect); rect.top =3D --bottom; rect.bottom =3D rect.top + 1; - UnsafeIntUnionRectWithRgn(obj, &rect); + REGION_UnionRectWithRgn(obj, &rect); yd -=3D 2*asq; d -=3D yd; } @@ -2320,10 +2258,10 @@ /* next vertical point */ rect.top =3D top++; rect.bottom =3D rect.top + 1; - UnsafeIntUnionRectWithRgn(obj, &rect); + REGION_UnionRectWithRgn(obj, &rect); rect.top =3D --bottom; rect.bottom =3D rect.top + 1; - UnsafeIntUnionRectWithRgn(obj, &rect); + REGION_UnionRectWithRgn(obj, &rect); if (d < 0) /* if nearest pixel is outside ellipse */ { rect.left--; /* move away from center */ @@ -2340,9 +2278,10 @@ { rect.top =3D top; rect.bottom =3D bottom; - UnsafeIntUnionRectWithRgn(obj, &rect); - } - RGNDATA_UnlockRgn(obj); + REGION_UnionRectWithRgn(obj, &rect); + } + + REGION_UnlockRgn(obj); return hrgn; } =
@@ -2358,12 +2297,12 @@ ULONG i; BOOL bRet =3D FALSE; =
- if ( !(rgn1 =3D RGNDATA_LockRgn(hSrcRgn1)) ) + if ( !(rgn1 =3D REGION_LockRgn(hSrcRgn1)) ) return ERROR; =
- if ( !(rgn2 =3D RGNDATA_LockRgn(hSrcRgn2)) ) - { - RGNDATA_UnlockRgn(rgn1); + if ( !(rgn2 =3D REGION_LockRgn(hSrcRgn2)) ) + { + REGION_UnlockRgn(rgn1); return ERROR; } =
@@ -2392,8 +2331,8 @@ bRet =3D TRUE; =
exit: - RGNDATA_UnlockRgn(rgn1); - RGNDATA_UnlockRgn(rgn2); + REGION_UnlockRgn(rgn1); + REGION_UnlockRgn(rgn2); return bRet; } =
@@ -2437,19 +2376,14 @@ return NULL; } =
- hRgn =3D RGNDATA_AllocRgn(nCount); - if (hRgn =3D=3D NULL) - { - SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); - return NULL; - } - - Region =3D RGNDATA_LockRgn(hRgn); + Region =3D REGION_AllocRgnWithHandle(nCount); + if (Region =3D=3D NULL) { SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } + hRgn =3D Region->BaseObject.hHmgr; =
_SEH_TRY { @@ -2468,12 +2402,12 @@ if (!NT_SUCCESS(Status)) { SetLastWin32Error(ERROR_INVALID_PARAMETER); - RGNDATA_UnlockRgn(Region); + REGION_UnlockRgn(Region); NtGdiDeleteObject(hRgn); return NULL; } =
- RGNDATA_UnlockRgn(Region); + REGION_UnlockRgn(Region); =
return hRgn; } @@ -2490,14 +2424,14 @@ PROSRGNDATA rgn; PRECT r; =
- if (NULL =3D=3D (rgn =3D RGNDATA_LockRgn(hRgn))) + if (NULL =3D=3D (rgn =3D REGION_LockRgn(hRgn))) { return FALSE; } =
if (NULL =3D=3D (oldhBrush =3D NtGdiSelectBrush(hDC, hBrush))) { - RGNDATA_UnlockRgn(rgn); + REGION_UnlockRgn(rgn); return FALSE; } =
@@ -2506,7 +2440,7 @@ NtGdiPatBlt(hDC, r->left, r->top, r->right - r->left, r->bottom - = r->top, PATCOPY); } =
- RGNDATA_UnlockRgn(rgn); + REGION_UnlockRgn(rgn); NtGdiSelectBrush(hDC, oldhBrush); =
return TRUE; @@ -2542,7 +2476,7 @@ } =
INT FASTCALL -UnsafeIntGetRgnBox( +REGION_GetRgnBox( PROSRGNDATA Rgn, LPRECT pRect ) @@ -2637,13 +2571,13 @@ PROSRGNDATA Rgn; DWORD ret; =
- if (!(Rgn =3D RGNDATA_LockRgn(hRgn))) + if (!(Rgn =3D REGION_LockRgn(hRgn))) { return ERROR; } =
- ret =3D UnsafeIntGetRgnBox(Rgn, pRect); - RGNDATA_UnlockRgn(Rgn); + ret =3D REGION_GetRgnBox(Rgn, pRect); + REGION_UnlockRgn(Rgn); =
return ret; } @@ -2660,13 +2594,13 @@ DWORD ret; NTSTATUS Status =3D STATUS_SUCCESS; =
- if (!(Rgn =3D RGNDATA_LockRgn(hRgn))) + if (!(Rgn =3D REGION_LockRgn(hRgn))) { return ERROR; } =
- ret =3D UnsafeIntGetRgnBox(Rgn, &SafeRect); - RGNDATA_UnlockRgn(Rgn); + ret =3D REGION_GetRgnBox(Rgn, &SafeRect); + REGION_UnlockRgn(Rgn); if (ERROR =3D=3D ret) { return ret; @@ -2701,7 +2635,7 @@ ULONG i; PRECT rc; =
- if (!(RgnData =3D RGNDATA_LockRgn(hRgn))) + if (!(RgnData =3D REGION_LockRgn(hRgn))) { SetLastWin32Error(ERROR_INVALID_HANDLE); return FALSE; @@ -2713,13 +2647,13 @@ =
if (!NtGdiPatBlt(hDC, rc->left, rc->top, rc->right - rc->left, rc-=
bottom - rc->top, DSTINVERT))
{ - RGNDATA_UnlockRgn(RgnData); + REGION_UnlockRgn(RgnData); return FALSE; } rc++; } =
- RGNDATA_UnlockRgn(RgnData); + REGION_UnlockRgn(RgnData); return TRUE; } =
@@ -2731,7 +2665,7 @@ INT YOffset ) { - PROSRGNDATA rgn =3D RGNDATA_LockRgn(hRgn); + PROSRGNDATA rgn =3D REGION_LockRgn(hRgn); INT ret; =
DPRINT("NtGdiOffsetRgn: hRgn %d Xoffs %d Yoffs %d rgn %x\n", hRgn, XOf= fset, YOffset, rgn ); @@ -2767,7 +2701,7 @@ } } ret =3D rgn->rdh.iType; - RGNDATA_UnlockRgn(rgn); + REGION_UnlockRgn(rgn); return ret; } =
@@ -2813,8 +2747,8 @@ NtGdiCombineRgn(tmpVisRgn, tmpVisRgn, dc->w.hGCClipRgn, RGN_AND); */ =
- //visrgn =3D RGNDATA_LockRgn(tmpVisRgn); - visrgn =3D RGNDATA_LockRgn(hRgn); + //visrgn =3D REGION_LockRgn(tmpVisRgn); + visrgn =3D REGION_LockRgn(hRgn); if (visrgn =3D=3D NULL) { NtGdiDeleteObject(tmpVisRgn); @@ -2843,7 +2777,7 @@ =
BITMAPOBJ_UnlockBitmap(BitmapObj); BRUSHOBJ_UnlockBrush(pBrush); - RGNDATA_UnlockRgn(visrgn); + REGION_UnlockRgn(visrgn); NtGdiDeleteObject(tmpVisRgn); =
// Fill the region @@ -2862,7 +2796,7 @@ ULONG i; PRECT r; =
- if (!(rgn =3D RGNDATA_LockRgn(hRgn) ) ) + if (!(rgn =3D REGION_LockRgn(hRgn) ) ) return FALSE; =
if (rgn->rdh.nCount > 0 && INRECT(rgn->rdh.rcBound, X, Y)) @@ -2872,19 +2806,19 @@ { if (INRECT(*r, X, Y)) { - RGNDATA_UnlockRgn(rgn); + REGION_UnlockRgn(rgn); return TRUE; } r++; } } - RGNDATA_UnlockRgn(rgn); + REGION_UnlockRgn(rgn); return FALSE; } =
BOOL FASTCALL -UnsafeIntRectInRegion( +REGION_RectInRegion( PROSRGNDATA Rgn, CONST LPRECT rc ) @@ -2919,7 +2853,7 @@ BOOL Ret; NTSTATUS Status =3D STATUS_SUCCESS; =
- if (!(Rgn =3D RGNDATA_LockRgn(hRgn))) + if (!(Rgn =3D REGION_LockRgn(hRgn))) { return ERROR; } @@ -2937,15 +2871,55 @@ =
if (!NT_SUCCESS(Status)) { - RGNDATA_UnlockRgn(Rgn); + REGION_UnlockRgn(Rgn); SetLastNtError(Status); DPRINT1("NtGdiRectInRegion: bogus rc\n"); return ERROR; } =
- Ret =3D UnsafeIntRectInRegion(Rgn, &rc); - RGNDATA_UnlockRgn(Rgn); + Ret =3D REGION_RectInRegion(Rgn, &rc); + REGION_UnlockRgn(Rgn); return Ret; +} + +VOID +FASTCALL +REGION_SetRectRgn( + PROSRGNDATA rgn, + INT LeftRect, + INT TopRect, + INT RightRect, + INT BottomRect +) +{ + PRECT firstRect; + + if (LeftRect > RightRect) + { + INT tmp =3D LeftRect; + LeftRect =3D RightRect; + RightRect =3D tmp; + } + if (TopRect > BottomRect) + { + INT tmp =3D TopRect; + TopRect =3D BottomRect; + BottomRect =3D tmp; + } + + if ((LeftRect !=3D RightRect) && (TopRect !=3D BottomRect)) + { + firstRect =3D (PRECT)rgn->Buffer; + ASSERT(firstRect); + firstRect->left =3D rgn->rdh.rcBound.left =3D LeftRect; + firstRect->top =3D rgn->rdh.rcBound.top =3D TopRect; + firstRect->right =3D rgn->rdh.rcBound.right =3D RightRect; + firstRect->bottom =3D rgn->rdh.rcBound.bottom =3D BottomRect; + rgn->rdh.nCount =3D 1; + rgn->rdh.iType =3D SIMPLEREGION; + } + else + EMPTY_REGION(rgn); } =
BOOL @@ -2959,41 +2933,15 @@ ) { PROSRGNDATA rgn; - PRECT firstRect; - - - - if ( !(rgn =3D RGNDATA_LockRgn(hRgn)) ) + + if ( !(rgn =3D REGION_LockRgn(hRgn)) ) + { return 0; //per documentation - - if (LeftRect > RightRect) - { - INT tmp =3D LeftRect; - LeftRect =3D RightRect; - RightRect =3D tmp; - } - if (TopRect > BottomRect) - { - INT tmp =3D TopRect; - TopRect =3D BottomRect; - BottomRect =3D tmp; - } - - if ((LeftRect !=3D RightRect) && (TopRect !=3D BottomRect)) - { - firstRect =3D (PRECT)rgn->Buffer; - ASSERT(firstRect); - firstRect->left =3D rgn->rdh.rcBound.left =3D LeftRect; - firstRect->top =3D rgn->rdh.rcBound.top =3D TopRect; - firstRect->right =3D rgn->rdh.rcBound.right =3D RightRect; - firstRect->bottom =3D rgn->rdh.rcBound.bottom =3D BottomRect; - rgn->rdh.nCount =3D 1; - rgn->rdh.iType =3D SIMPLEREGION; - } - else - EMPTY_REGION(rgn); - - RGNDATA_UnlockRgn(rgn); + } + + REGION_SetRectRgn(rgn, LeftRect, TopRect, RightRect, BottomRect); + + REGION_UnlockRgn(rgn); return TRUE; } =
@@ -3007,7 +2955,7 @@ PROSRGNDATA Rgn; NTSTATUS Status =3D STATUS_SUCCESS; =
- if (!(Rgn =3D (PROSRGNDATA)RGNDATA_LockRgn(hDest))) + if (!(Rgn =3D REGION_LockRgn(hDest))) { SetLastWin32Error(ERROR_INVALID_HANDLE); return NULL; @@ -3026,13 +2974,13 @@ =
if (! NT_SUCCESS(Status)) { - RGNDATA_UnlockRgn(Rgn); + REGION_UnlockRgn(Rgn); SetLastNtError(Status); return NULL; } =
- UnsafeIntUnionRectWithRgn(Rgn, &SafeRect); - RGNDATA_UnlockRgn(Rgn); + REGION_UnionRectWithRgn(Rgn, &SafeRect); + REGION_UnlockRgn(Rgn); return hDest; } =
@@ -3054,7 +3002,7 @@ ) { DWORD size; - PROSRGNDATA obj =3D RGNDATA_LockRgn(hrgn); + PROSRGNDATA obj =3D REGION_LockRgn(hrgn); NTSTATUS Status =3D STATUS_SUCCESS; =
if (!obj) @@ -3063,10 +3011,10 @@ size =3D obj->rdh.nCount * sizeof(RECT); if (count < (size + sizeof(RGNDATAHEADER)) || rgndata =3D=3D NULL) { - RGNDATA_UnlockRgn(obj); + REGION_UnlockRgn(obj); if (rgndata) /* buffer is too small, signal it by return 0 */ return 0; - else /* user requested buffer size with rgndata NULL */ + else /* user requested buffer size with rgndata NULL */ return size + sizeof(RGNDATAHEADER); } =
@@ -3089,11 +3037,11 @@ if (!NT_SUCCESS(Status)) { SetLastNtError(Status); - RGNDATA_UnlockRgn(obj); + REGION_UnlockRgn(obj); return 0; } =
- RGNDATA_UnlockRgn(obj); + REGION_UnlockRgn(obj); return size + sizeof(RGNDATAHEADER); } =
@@ -3560,13 +3508,9 @@ int numFullPtBlocks =3D 0; INT poly, total; =
- if (!(hrgn =3D RGNDATA_AllocRgn(nbpolygons))) + if (!(region =3D REGION_AllocRgnWithHandle(nbpolygons))) return 0; - if (!(region =3D RGNDATA_LockRgn(hrgn))) - { - NtGdiDeleteObject(hrgn); - return 0; - } + hrgn =3D region->BaseObject.hHmgr; =
/* special case a rectangle */ =
@@ -3581,7 +3525,7 @@ (Pts[2].x =3D=3D Pts[3].x) && (Pts[3].y =3D=3D Pts[0].y)))) { - RGNDATA_UnlockRgn(region); + REGION_UnlockRgn(region); NtGdiSetRectRgn(hrgn, min(Pts[0].x, Pts[2].x), min(Pts[0].y, Pts[2= ].y), max(Pts[0].x, Pts[2].x), max(Pts[0].y, Pts[2].y)); return hrgn; @@ -3730,7 +3674,7 @@ curPtBlock =3D tmpPtBlock; } ExFreePool(pETEs); - RGNDATA_UnlockRgn(region); + REGION_UnlockRgn(region); return hrgn; } =