Author: jimtabor Date: Thu Jan 21 14:18:33 2010 New Revision: 45181
URL: http://svn.reactos.org/svn/reactos?rev=45181&view=rev Log: [Win32k] - Fixes to region support code. See bug 5124.
Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h trunk/reactos/subsystems/win32/win32k/include/gdiobj.h trunk/reactos/subsystems/win32/win32k/include/region.h trunk/reactos/subsystems/win32/win32k/ntuser/message.c trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c trunk/reactos/subsystems/win32/win32k/ntuser/painting.c trunk/reactos/subsystems/win32/win32k/ntuser/vis.c trunk/reactos/subsystems/win32/win32k/ntuser/windc.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/dclife.c trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c trunk/reactos/subsystems/win32/win32k/objects/region.c
Modified: trunk/reactos/subsystems/win32/win32k/include/dc.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -26,7 +26,7 @@ typedef struct _ROS_DC_INFO { HRGN hClipRgn; /* Clip region (may be 0) */ - HRGN hVisRgn; /* Should me to DC. Visible region (must never be 0) */ + HRGN hVisRgn; /* Visible region (must never be 0) */ HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
BYTE bitsPerPixel;
Modified: trunk/reactos/subsystems/win32/win32k/include/gdiobj.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/gdiobj.h [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -85,7 +85,7 @@ BOOL FASTCALL GreDeleteObject(HGDIOBJ hObject); BOOL FASTCALL IsObjectDead(HGDIOBJ); BOOL FASTCALL IntGdiSetDCOwnerEx( HDC, DWORD, BOOL); -BOOL FASTCALL IntGdiSetRegeionOwner(HRGN,DWORD); +BOOL FASTCALL IntGdiSetRegionOwner(HRGN,DWORD);
/*! * Release GDI object. Every object locked by GDIOBJ_LockObj() must be unlocked.
Modified: trunk/reactos/subsystems/win32/win32k/include/region.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/region.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/region.h [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -50,8 +50,9 @@ PROSRGNDATA FASTCALL IntGdiCreateRectRgn(INT, INT, INT, INT); PROSRGNDATA FASTCALL RGNOBJAPI_Lock(HRGN,PRGN_ATTR *); VOID FASTCALL RGNOBJAPI_Unlock(PROSRGNDATA); +HRGN FASTCALL IntSysCreateRectRgn(INT,INT,INT,INT);
-#define UnsafeIntCreateRectRgnIndirect(prc) \ - NtGdiCreateRectRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom) +#define IntSysCreateRectRgnIndirect(prc) \ + IntSysCreateRectRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom)
#endif /* not __WIN32K_REGION_H */
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -416,9 +416,9 @@ if (pMsg->message == WM_PAINT) { /* send a WM_NCPAINT and WM_ERASEBKGND if the non-client area is still invalid */ - HRGN hrgn = NtGdiCreateRectRgn( 0, 0, 0, 0 ); + HRGN hrgn = IntSysCreateRectRgn( 0, 0, 0, 0 ); co_UserGetUpdateRgn( Window, hrgn, TRUE ); - GreDeleteObject( hrgn ); + REGION_FreeRgnByHandle( hrgn ); } return retval; }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/monitor.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -190,12 +190,9 @@ Monitor->rcWork = Monitor->rcMonitor; Monitor->cWndStack = 0;
- Monitor->hrgnMonitor= NtGdiCreateRectRgn( Monitor->rcMonitor.left, - Monitor->rcMonitor.top, - Monitor->rcMonitor.right, - Monitor->rcMonitor.bottom ); - - IntGdiSetRegeionOwner(Monitor->hrgnMonitor, GDI_OBJ_HMGR_PUBLIC); + Monitor->hrgnMonitor= IntSysCreateRectRgnIndirect( &Monitor->rcMonitor ); + + IntGdiSetRegionOwner(Monitor->hrgnMonitor, GDI_OBJ_HMGR_PUBLIC);
if (gMonitorList == NULL) {
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -106,9 +106,9 @@
Wnd = Window->Wnd; if (Client) - hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Wnd->rcClient); + hRgnWindow = IntSysCreateRectRgnIndirect(&Wnd->rcClient); else - hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Wnd->rcWindow); + hRgnWindow = IntSysCreateRectRgnIndirect(&Wnd->rcWindow);
if (Window->hrgnClip != NULL && !(Wnd->style & WS_MINIMIZE)) { @@ -163,7 +163,7 @@ hRgnWindow = IntCalcWindowRgn(Window, TRUE); if (hRgnWindow == NULL) { - GreDeleteObject(hRgnNonClient); + REGION_FreeRgnByHandle(hRgnNonClient); return (HRGN)1; }
@@ -171,14 +171,14 @@ hRgnWindow, RGN_DIFF); if (RgnType == ERROR) { - GreDeleteObject(hRgnWindow); - GreDeleteObject(hRgnNonClient); + REGION_FreeRgnByHandle(hRgnWindow); + REGION_FreeRgnByHandle(hRgnNonClient); return (HRGN)1; } else if (RgnType == NULLREGION) { - GreDeleteObject(hRgnWindow); - GreDeleteObject(hRgnNonClient); + REGION_FreeRgnByHandle(hRgnWindow); + REGION_FreeRgnByHandle(hRgnNonClient); return NULL; }
@@ -192,15 +192,15 @@ if (NtGdiCombineRgn(Window->hrgnUpdate, Window->hrgnUpdate, hRgnWindow, RGN_AND) == NULLREGION) { - GDIOBJ_SetOwnership(Window->hrgnUpdate, PsGetCurrentProcess()); - GreDeleteObject(Window->hrgnUpdate); + IntGdiSetRegionOwner(Window->hrgnUpdate, GDI_OBJ_HMGR_POWNED); + REGION_FreeRgnByHandle(Window->hrgnUpdate); Window->hrgnUpdate = NULL; if (!(Window->state & WINDOWOBJECT_NEED_INTERNALPAINT)) MsqDecPaintCountQueue(Window->pti->MessageQueue); } }
- GreDeleteObject(hRgnWindow); + REGION_FreeRgnByHandle(hRgnWindow);
return hRgnNonClient; } @@ -334,9 +334,9 @@ { HRGN hRgnClient;
- hRgnClient = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcClient); + hRgnClient = IntSysCreateRectRgnIndirect(&Window->Wnd->rcClient); RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnClient, RGN_AND); - GreDeleteObject(hRgnClient); + REGION_FreeRgnByHandle(hRgnClient); }
/* @@ -347,9 +347,9 @@ { HRGN hRgnWindow;
- hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcWindow); + hRgnWindow = IntSysCreateRectRgnIndirect(&Window->Wnd->rcWindow); RgnType = NtGdiCombineRgn(hRgn, hRgn, hRgnWindow, RGN_AND); - GreDeleteObject(hRgnWindow); + REGION_FreeRgnByHandle(hRgnWindow); } else { @@ -378,15 +378,15 @@ { if (Window->hrgnUpdate == NULL) { - Window->hrgnUpdate = NtGdiCreateRectRgn(0, 0, 0, 0); - GDIOBJ_SetOwnership(Window->hrgnUpdate, NULL); + Window->hrgnUpdate = IntSysCreateRectRgn(0, 0, 0, 0); + IntGdiSetRegionOwner(Window->hrgnUpdate, GDI_OBJ_HMGR_PUBLIC); }
if (NtGdiCombineRgn(Window->hrgnUpdate, Window->hrgnUpdate, hRgn, RGN_OR) == NULLREGION) { - GDIOBJ_SetOwnership(Window->hrgnUpdate, PsGetCurrentProcess()); - GreDeleteObject(Window->hrgnUpdate); + IntGdiSetRegionOwner(Window->hrgnUpdate, GDI_OBJ_HMGR_POWNED); + REGION_FreeRgnByHandle(Window->hrgnUpdate); Window->hrgnUpdate = NULL; }
@@ -405,8 +405,8 @@ if (NtGdiCombineRgn(Window->hrgnUpdate, Window->hrgnUpdate, hRgn, RGN_DIFF) == NULLREGION) { - GDIOBJ_SetOwnership(Window->hrgnUpdate, PsGetCurrentProcess()); - GreDeleteObject(Window->hrgnUpdate); + IntGdiSetRegionOwner(Window->hrgnUpdate, GDI_OBJ_HMGR_POWNED); + REGION_FreeRgnByHandle(Window->hrgnUpdate); Window->hrgnUpdate = NULL; } } @@ -445,10 +445,10 @@ /* * Recursive call to update children hrgnUpdate */ - HRGN hRgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0); + HRGN hRgnTemp = IntSysCreateRectRgn(0, 0, 0, 0); NtGdiCombineRgn(hRgnTemp, hRgn, 0, RGN_COPY); IntInvalidateWindows(Child, hRgnTemp, Flags); - GreDeleteObject(hRgnTemp); + REGION_FreeRgnByHandle(hRgnTemp); }
} @@ -542,10 +542,10 @@ { if (UpdateRgn != NULL) { - hRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + hRgn = IntSysCreateRectRgn(0, 0, 0, 0); if (NtGdiCombineRgn(hRgn, UpdateRgn, NULL, RGN_COPY) == NULLREGION) { - GreDeleteObject(hRgn); + REGION_FreeRgnByHandle(hRgn); hRgn = NULL; } else @@ -555,7 +555,7 @@ { if (!RECTL_bIsEmptyRect(UpdateRect)) { - hRgn = UnsafeIntCreateRectRgnIndirect((RECTL *)UpdateRect); + hRgn = IntSysCreateRectRgnIndirect((RECTL *)UpdateRect); NtGdiOffsetRgn(hRgn, Window->Wnd->rcClient.left, Window->Wnd->rcClient.top); } } @@ -563,12 +563,12 @@ (Flags & (RDW_VALIDATE | RDW_NOFRAME)) == (RDW_VALIDATE | RDW_NOFRAME)) { if (!RECTL_bIsEmptyRect(&Window->Wnd->rcWindow)) - hRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcWindow); + hRgn = IntSysCreateRectRgnIndirect(&Window->Wnd->rcWindow); } else { if (!RECTL_bIsEmptyRect(&Window->Wnd->rcClient)) - hRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcClient); + hRgn = IntSysCreateRectRgnIndirect(&Window->Wnd->rcClient); } }
@@ -600,7 +600,7 @@
if (hRgn != NULL) { - GreDeleteObject(hRgn); + REGION_FreeRgnByHandle(hRgn); }
return TRUE; @@ -797,7 +797,7 @@ { MsqDecPaintCountQueue(Window->pti->MessageQueue); GdiGetClipBox(Ps.hdc, &Ps.rcPaint); - GDIOBJ_SetOwnership(Window->hrgnUpdate, PsGetCurrentProcess()); + IntGdiSetRegionOwner(Window->hrgnUpdate, GDI_OBJ_HMGR_POWNED); /* The region is part of the dc now and belongs to the process! */ Window->hrgnUpdate = NULL; } @@ -1178,11 +1178,11 @@ } else { - hrgnOwn = UnsafeIntCreateRectRgnIndirect(&rcDst); + hrgnOwn = IntSysCreateRectRgnIndirect(&rcDst); }
/* Add the source rect */ - hrgnTmp = UnsafeIntCreateRectRgnIndirect(&rcSrc); + hrgnTmp = IntSysCreateRectRgnIndirect(&rcSrc); NtGdiCombineRgn(hrgnOwn, hrgnOwn, hrgnTmp, RGN_OR);
/* Substract the part of the dest that was visible in source */ @@ -1190,7 +1190,7 @@ NtGdiOffsetRgn(hrgnTmp, dx, dy); Result = NtGdiCombineRgn(hrgnOwn, hrgnOwn, hrgnTmp, RGN_DIFF);
- GreDeleteObject(hrgnTmp); + REGION_FreeRgnByHandle(hrgnTmp);
if (prcUpdate) { @@ -1199,7 +1199,7 @@
if (!hrgnUpdate) { - GreDeleteObject(hrgnOwn); + REGION_FreeRgnByHandle(hrgnOwn); } } else @@ -1366,7 +1366,7 @@ if (hrgnUpdate) hrgnOwn = hrgnUpdate; else - hrgnOwn = NtGdiCreateRectRgn(0, 0, 0, 0); + hrgnOwn = IntSysCreateRectRgn(0, 0, 0, 0);
hDC = UserGetDCEx(Window, 0, DCX_CACHE | DCX_USESTYLE); if (!hDC) @@ -1386,16 +1386,16 @@ * the scroll. */
- hrgnTemp = NtGdiCreateRectRgn(0, 0, 0, 0); + hrgnTemp = IntSysCreateRectRgn(0, 0, 0, 0); if (co_UserGetUpdateRgn(Window, hrgnTemp, FALSE) != NULLREGION) { - HRGN hrgnClip = UnsafeIntCreateRectRgnIndirect(&rcClip); + HRGN hrgnClip = IntSysCreateRectRgnIndirect(&rcClip); NtGdiOffsetRgn(hrgnTemp, dx, dy); NtGdiCombineRgn(hrgnTemp, hrgnTemp, hrgnClip, RGN_AND); co_UserRedrawWindow(Window, NULL, hrgnTemp, RDW_INVALIDATE | RDW_ERASE); - GreDeleteObject(hrgnClip); - } - GreDeleteObject(hrgnTemp); + REGION_FreeRgnByHandle(hrgnClip); + } + REGION_FreeRgnByHandle(hrgnTemp);
if (flags & SW_SCROLLCHILDREN) { @@ -1468,7 +1468,7 @@ CLEANUP: if (hrgnOwn && !hrgnUpdate) { - GreDeleteObject(hrgnOwn); + REGION_FreeRgnByHandle(hrgnOwn); }
if (Window)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/vis.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/vis.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/vis.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -16,7 +16,6 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * $Id$ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -50,11 +49,11 @@
if (ClientArea) { - VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcClient); + VisRgn = IntSysCreateRectRgnIndirect(&Window->Wnd->rcClient); } else { - VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcWindow); + VisRgn = IntSysCreateRectRgnIndirect(&Window->Wnd->rcWindow); }
/* @@ -78,13 +77,13 @@ CurrentWnd = CurrentWindow->Wnd; if (!CurrentWnd || !(CurrentWnd->style & WS_VISIBLE)) { - GreDeleteObject(VisRgn); + REGION_FreeRgnByHandle(VisRgn); return NULL; }
- ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWnd->rcClient); + ClipRgn = IntSysCreateRectRgnIndirect(&CurrentWnd->rcClient); NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_AND); - GreDeleteObject(ClipRgn); + REGION_FreeRgnByHandle(ClipRgn);
if ((PreviousWnd->style & WS_CLIPSIBLINGS) || (PreviousWnd == Wnd && ClipSiblings)) @@ -96,7 +95,7 @@ if ((CurrentSiblingWnd->style & WS_VISIBLE) && !(CurrentSiblingWnd->ExStyle & WS_EX_TRANSPARENT)) { - ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentSiblingWnd->rcWindow); + ClipRgn = IntSysCreateRectRgnIndirect(&CurrentSiblingWnd->rcWindow); /* Combine it with the window region if available */ if (CurrentSibling->hrgnClip && !(CurrentSiblingWnd->style & WS_MINIMIZE)) { @@ -105,7 +104,7 @@ NtGdiOffsetRgn(ClipRgn, CurrentSiblingWnd->rcWindow.left, CurrentSiblingWnd->rcWindow.top); } NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF); - GreDeleteObject(ClipRgn); + REGION_FreeRgnByHandle(ClipRgn); } CurrentSibling = CurrentSibling->spwndNext; } @@ -125,7 +124,7 @@ if ((CurrentWnd->style & WS_VISIBLE) && !(CurrentWnd->ExStyle & WS_EX_TRANSPARENT)) { - ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWnd->rcWindow); + ClipRgn = IntSysCreateRectRgnIndirect(&CurrentWnd->rcWindow); /* Combine it with the window region if available */ if (CurrentWindow->hrgnClip && !(CurrentWnd->style & WS_MINIMIZE)) { @@ -134,7 +133,7 @@ NtGdiOffsetRgn(ClipRgn, CurrentWnd->rcWindow.left, CurrentWnd->rcWindow.top); } NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF); - GreDeleteObject(ClipRgn); + REGION_FreeRgnByHandle(ClipRgn); } CurrentWindow = CurrentWindow->spwndNext; } @@ -164,7 +163,7 @@
Wnd = Window->Wnd;
- Temp = NtGdiCreateRectRgn(0, 0, 0, 0); + Temp = IntSysCreateRectRgn(0, 0, 0, 0); NtGdiCombineRgn(Temp, NewlyExposed, NULL, RGN_COPY);
Parent = Window->spwndParent; @@ -181,7 +180,7 @@ RDW_ALLCHILDREN); UserDerefObjectCo(Parent); } - GreDeleteObject(Temp); + REGION_FreeRgnByHandle(Temp); }
/* EOF */
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -63,7 +63,7 @@ 0 != (Flags & DCX_CLIPSIBLINGS));
if (VisRgn == NULL) - VisRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + VisRgn = IntSysCreateRectRgn(0, 0, 0, 0);
return VisRgn; } @@ -182,7 +182,7 @@ } else if (Dce->hrgnClip != NULL) { - GreDeleteObject(Dce->hrgnClip); + REGION_FreeRgnByHandle(Dce->hrgnClip); }
Dce->hrgnClip = NULL; @@ -274,7 +274,7 @@ DesktopWindow = UserGetWindowObject(IntGetDesktopWindow()); if (NULL != DesktopWindow) { - hRgnVisible = UnsafeIntCreateRectRgnIndirect(&DesktopWindow->Wnd->rcWindow); + hRgnVisible = IntSysCreateRectRgnIndirect(&DesktopWindow->Wnd->rcWindow); } else { @@ -297,9 +297,9 @@ { if(hRgnVisible != NULL) { - GreDeleteObject(hRgnVisible); - } - hRgnVisible = NtGdiCreateRectRgn(0, 0, 0, 0); + REGION_FreeRgnByHandle(hRgnVisible); + } + hRgnVisible = IntSysCreateRectRgn(0, 0, 0, 0); } }
@@ -318,7 +318,7 @@
if (hRgnVisible != NULL) { - GreDeleteObject(hRgnVisible); + REGION_FreeRgnByHandle(hRgnVisible); } }
@@ -526,7 +526,7 @@ if (!(Flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) && ClipRegion) { if (!(Flags & DCX_KEEPCLIPRGN)) - GreDeleteObject(ClipRegion); + REGION_FreeRgnByHandle(ClipRegion); ClipRegion = NULL; }
@@ -550,11 +550,11 @@ { if (!(Flags & DCX_WINDOW)) { - Dce->hrgnClip = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcClient); + Dce->hrgnClip = IntSysCreateRectRgnIndirect(&Window->Wnd->rcClient); } else { - Dce->hrgnClip = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcWindow); + Dce->hrgnClip = IntSysCreateRectRgnIndirect(&Window->Wnd->rcWindow); } Dce->DCXFlags &= ~DCX_KEEPCLIPRGN; } @@ -617,7 +617,7 @@
if (pdce->hrgnClip && ! (pdce->DCXFlags & DCX_KEEPCLIPRGN)) { - GreDeleteObject(pdce->hrgnClip); + REGION_FreeRgnByHandle(pdce->hrgnClip); }
RemoveEntryList(&pdce->List);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -4553,7 +4553,7 @@ Wnd = Window->Wnd;
/* Create a new window region using the window rectangle */ - VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcWindow); + VisRgn = IntSysCreateRectRgnIndirect(&Window->Wnd->rcWindow); NtGdiOffsetRgn(VisRgn, -Window->Wnd->rcWindow.left, -Window->Wnd->rcWindow.top); /* if there's a region assigned to the window, combine them both */ if(Window->hrgnClip && !(Wnd->style & WS_MINIMIZE)) @@ -4569,7 +4569,7 @@ else Ret = ERROR;
- GreDeleteObject(VisRgn); + REGION_FreeRgnByHandle(VisRgn);
return Ret; } @@ -4594,7 +4594,7 @@ Wnd = Window->Wnd;
/* Create a new window region using the window rectangle */ - VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->rcWindow); + VisRgn = IntSysCreateRectRgnIndirect(&Window->Wnd->rcWindow); NtGdiOffsetRgn(VisRgn, -Window->Wnd->rcWindow.left, -Window->Wnd->rcWindow.top); /* if there's a region assigned to the window, combine them both */ if(Window->hrgnClip && !(Wnd->style & WS_MINIMIZE)) @@ -4609,7 +4609,7 @@ else Ret = ERROR;
- GreDeleteObject(VisRgn); + REGION_FreeRgnByHandle(VisRgn);
return Ret; }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -1135,7 +1135,7 @@ ((WinPos.flags & SWP_NOSIZE) || !(WvrFlags & WVR_REDRAW)) && !(Window->Wnd->ExStyle & WS_EX_TRANSPARENT)) { - CopyRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + CopyRgn = IntSysCreateRectRgn(0, 0, 0, 0); RgnType = NtGdiCombineRgn(CopyRgn, VisAfter, VisBefore, RGN_AND);
/* @@ -1178,7 +1178,7 @@ { /* Nothing to copy, clean up */ RGNOBJAPI_Unlock(VisRgn); - GreDeleteObject(CopyRgn); + REGION_FreeRgnByHandle(CopyRgn); CopyRgn = NULL; } else if (OldWindowRect.left != NewWindowRect.left || @@ -1224,7 +1224,7 @@ /* We need to redraw what wasn't visible before */ if (VisAfter != NULL) { - DirtyRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + DirtyRgn = IntSysCreateRectRgn(0, 0, 0, 0); if (CopyRgn != NULL) { RgnType = NtGdiCombineRgn(DirtyRgn, VisAfter, CopyRgn, RGN_DIFF); @@ -1262,18 +1262,18 @@ RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); } } - GreDeleteObject(DirtyRgn); + REGION_FreeRgnByHandle(DirtyRgn); }
if (CopyRgn != NULL) { - GreDeleteObject(CopyRgn); + REGION_FreeRgnByHandle(CopyRgn); }
/* Expose what was covered before but not covered anymore */ if (VisBefore != NULL) { - ExposedRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + ExposedRgn = IntSysCreateRectRgn(0, 0, 0, 0); NtGdiCombineRgn(ExposedRgn, VisBefore, NULL, RGN_COPY); NtGdiOffsetRgn(ExposedRgn, OldWindowRect.left - NewWindowRect.left, OldWindowRect.top - NewWindowRect.top); @@ -1286,13 +1286,13 @@ { co_VIS_WindowLayoutChanged(Window, ExposedRgn); } - GreDeleteObject(ExposedRgn); - GreDeleteObject(VisBefore); + REGION_FreeRgnByHandle(ExposedRgn); + REGION_FreeRgnByHandle(VisBefore); }
if (VisAfter != NULL) { - GreDeleteObject(VisAfter); + REGION_FreeRgnByHandle(VisAfter); }
if (!(WinPos.flags & SWP_NOACTIVATE))
Modified: trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/cliprgn.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -27,8 +27,13 @@ { PROSRGNDATA CombinedRegion;
+ if (!Dc->rosdc.hVisRgn) + { + DPRINT1("Warning, hVisRgn is NULL!\n"); + } + if (Dc->rosdc.hGCClipRgn == NULL) - Dc->rosdc.hGCClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + Dc->rosdc.hGCClipRgn = IntSysCreateRectRgn(0, 0, 0, 0);
if (Dc->rosdc.hClipRgn == NULL) NtGdiCombineRgn(Dc->rosdc.hGCClipRgn, Dc->rosdc.hVisRgn, 0, RGN_COPY); @@ -79,7 +84,7 @@
if (dc->rosdc.hVisRgn == NULL) { - dc->rosdc.hVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + dc->rosdc.hVisRgn = IntSysCreateRectRgn(0, 0, 0, 0); GDIOBJ_CopyOwnership(hdc, dc->rosdc.hVisRgn); }
@@ -107,7 +112,7 @@ { if (dc->rosdc.hClipRgn != NULL) { - GreDeleteObject(dc->rosdc.hClipRgn); + REGION_FreeRgnByHandle(dc->rosdc.hClipRgn); dc->rosdc.hClipRgn = NULL; } } @@ -127,11 +132,11 @@ { REGION_GetRgnBox(Rgn, &rect); RGNOBJAPI_Unlock(Rgn); - dc->rosdc.hClipRgn = UnsafeIntCreateRectRgnIndirect(&rect); + dc->rosdc.hClipRgn = IntSysCreateRectRgnIndirect(&rect); } else { - dc->rosdc.hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + dc->rosdc.hClipRgn = IntSysCreateRectRgn(0, 0, 0, 0); } } if(fnMode == RGN_COPY) @@ -245,7 +250,7 @@
IntLPtoDP(dc, (LPPOINT)&Rect, 2);
- NewRgn = UnsafeIntCreateRectRgnIndirect(&Rect); + NewRgn = IntSysCreateRectRgnIndirect(&Rect); if (!NewRgn) { Result = ERROR; @@ -254,7 +259,7 @@ { if (!dc->rosdc.hClipRgn) { - dc->rosdc.hClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); + dc->rosdc.hClipRgn = IntSysCreateRectRgn(0, 0, 0, 0); NtGdiCombineRgn(dc->rosdc.hClipRgn, dc->rosdc.hVisRgn, NewRgn, RGN_DIFF); Result = SIMPLEREGION; } @@ -262,7 +267,7 @@ { Result = NtGdiCombineRgn(dc->rosdc.hClipRgn, dc->rosdc.hClipRgn, NewRgn, RGN_DIFF); } - GreDeleteObject(NewRgn); + REGION_FreeRgnByHandle(NewRgn); } if (Result != ERROR) CLIPPING_UpdateGCRegion(dc); @@ -299,7 +304,7 @@
IntLPtoDP(dc, (LPPOINT)&Rect, 2);
- NewRgn = UnsafeIntCreateRectRgnIndirect(&Rect); + NewRgn = IntSysCreateRectRgnIndirect(&Rect); if (!NewRgn) { Result = ERROR; @@ -312,7 +317,7 @@ else { Result = NtGdiCombineRgn(dc->rosdc.hClipRgn, dc->rosdc.hClipRgn, NewRgn, RGN_AND); - GreDeleteObject(NewRgn); + REGION_FreeRgnByHandle(NewRgn); } if (Result != ERROR) CLIPPING_UpdateGCRegion(dc); @@ -430,7 +435,7 @@ { if ( pDC->dclevel.prgnClip ) { - TempRgn = IntGdiCreateRectRgn(0,0,0,0); + TempRgn = IntSysCreateRectRgn(0,0,0,0); if (TempRgn) { Ret = IntGdiCombineRgn( TempRgn, @@ -501,13 +506,13 @@ if (pDC->prgnAPI) { REGION_Delete(pDC->prgnAPI); - pDC->prgnAPI = IntGdiCreateRectRgn(0,0,0,0); + pDC->prgnAPI = IntSysCreateRectRgn(0,0,0,0); }
if (pDC->prgnRao) { REGION_Delete(pDC->prgnRao); - pDC->prgnRao = IntGdiCreateRectRgn(0,0,0,0); + pDC->prgnRao = IntSysCreateRectRgn(0,0,0,0); }
if (pDC->dclevel.prgnMeta && pDC->dclevel.prgnClip)
Modified: trunk/reactos/subsystems/win32/win32k/objects/dclife.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dclife.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -332,7 +332,7 @@
pdcattr->iCS_CP = ftGdiGetTextCharsetInfo(pdc,NULL,0);
- hVisRgn = NtGdiCreateRectRgn(0, 0, pdc->ppdev->gdiinfo.ulHorzRes, + hVisRgn = IntSysCreateRectRgn(0, 0, pdc->ppdev->gdiinfo.ulHorzRes, pdc->ppdev->gdiinfo.ulVertRes);
if (!CreateAsIC) @@ -365,7 +365,7 @@ if (hVisRgn) { GdiSelectVisRgn(hdc, hVisRgn); - GreDeleteObject(hVisRgn); + REGION_FreeRgnByHandle(hVisRgn); }
IntGdiSetTextAlign(hdc, TA_TOP); @@ -686,11 +686,11 @@ NtGdiDeleteObjectApp(DisplayDC); }
- hVisRgn = NtGdiCreateRectRgn(0, 0, 1, 1); + hVisRgn = IntSysCreateRectRgn(0, 0, 1, 1); if (hVisRgn) { GdiSelectVisRgn(hdcNew, hVisRgn); - GreDeleteObject(hVisRgn); + REGION_FreeRgnByHandle(hVisRgn); } if (Layout) NtGdiSetLayout(hdcNew, -1, Layout);
Modified: trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/dcobjs.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -298,10 +298,10 @@ }
/* FIXME; improve by using a region without a handle and selecting it */ - hVisRgn = NtGdiCreateRectRgn(0, - 0, - psurfBmp->SurfObj.sizlBitmap.cx, - psurfBmp->SurfObj.sizlBitmap.cy); + hVisRgn = IntSysCreateRectRgn( 0, + 0, + psurfBmp->SurfObj.sizlBitmap.cx, + psurfBmp->SurfObj.sizlBitmap.cy);
/* Release the exclusive lock */ SURFACE_UnlockSurface(psurfBmp); @@ -314,7 +314,7 @@ if (hVisRgn) { GdiSelectVisRgn(hDC, hVisRgn); - GreDeleteObject(hVisRgn); + REGION_FreeRgnByHandle(hVisRgn); }
return hOrgBmp;
Modified: trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/gdiobj.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -695,7 +695,7 @@
hPtr = GdiHandleCache->Handle + Offset;
- if ( oType == hctRegionHandle) + if ( pAttr && oType == hctRegionHandle) { if ( Number < CACHE_REGION_ENTRIES ) { @@ -746,14 +746,17 @@ break;
case GDI_OBJECT_TYPE_REGION: - if (bPEBCacheHandle(hObject, hctRegionHandle, pAttr)) + /* If pAttr NULL, the probability is high for System Region. */ + if ( pAttr && + bPEBCacheHandle(hObject, hctRegionHandle, pAttr)) { + /* User space handle only! */ return TRUE; } if (pAttr) { KeEnterCriticalRegion(); - if (pAttr) FreeObjectAttr(pAttr); + FreeObjectAttr(pAttr); Entry->UserData = NULL; KeLeaveCriticalRegion(); } @@ -1562,7 +1565,7 @@
BOOL FASTCALL -IntGdiSetRegeionOwner(HRGN hRgn, DWORD OwnerMask) +IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask) { INT Index; PGDI_TABLE_ENTRY Entry;
Modified: trunk/reactos/subsystems/win32/win32k/objects/region.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/obj... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/objects/region.c [iso-8859-1] Thu Jan 21 14:18:33 2010 @@ -2189,19 +2189,6 @@ // // System Region Functions // -INT -FASTCALL -IntSysRegComplexity(HRGN hRgn) -{ - PROSRGNDATA pRgn; - INT Ret; - - pRgn = REGION_LockRgn(hRgn); - Ret = REGION_Complexity( pRgn ); - REGION_UnlockRgn(pRgn); - return Ret; -} - HRGN FASTCALL IntSysCreateRectRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect) @@ -2430,13 +2417,13 @@
ASSERT(!(pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY)));
- if (!(tmpVisRgn = NtGdiCreateRectRgn(0, 0, 0, 0))) return FALSE; + if (!(tmpVisRgn = IntSysCreateRectRgn(0, 0, 0, 0))) return FALSE;
// Transform region into device co-ords if (!REGION_LPTODP(dc, tmpVisRgn, hRgn) || NtGdiOffsetRgn(tmpVisRgn, dc->ptlDCOrig.x, dc->ptlDCOrig.y) == ERROR) { - GreDeleteObject(tmpVisRgn); + REGION_FreeRgnByHandle(tmpVisRgn); return FALSE; }
@@ -2445,7 +2432,7 @@ visrgn = RGNOBJAPI_Lock(tmpVisRgn, NULL); if (visrgn == NULL) { - GreDeleteObject(tmpVisRgn); + REGION_FreeRgnByHandle(tmpVisRgn); return FALSE; }
@@ -2466,7 +2453,7 @@ 0xFFFF);//FIXME:don't know what to put here
RGNOBJAPI_Unlock(visrgn); - GreDeleteObject(tmpVisRgn); + REGION_FreeRgnByHandle(tmpVisRgn);
// Fill the region return TRUE; @@ -3598,19 +3585,19 @@ HRGN FrameRgn; BOOL Ret;
- if (!(FrameRgn = NtGdiCreateRectRgn(0, 0, 0, 0))) + if (!(FrameRgn = IntSysCreateRectRgn(0, 0, 0, 0))) { return FALSE; } if (!REGION_CreateFrameRgn(FrameRgn, hRgn, Width, Height)) { - GreDeleteObject(FrameRgn); + REGION_FreeRgnByHandle(FrameRgn); return FALSE; }
Ret = NtGdiFillRgn(hDC, FrameRgn, hBrush);
- GreDeleteObject(FrameRgn); + REGION_FreeRgnByHandle(FrameRgn); return Ret; }