- Fixes to region support code. See bug 5124. 

svn path=/trunk/; revision=45181
This commit is contained in:
James Tabor 2010-01-21 13:18:33 +00:00
parent 202f931c4e
commit 890497afd7
15 changed files with 123 additions and 131 deletions

View file

@ -26,7 +26,7 @@ typedef struct _DC *PDC;
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;

View file

@ -85,7 +85,7 @@ PVOID INTERNAL_CALL GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCES
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.

View file

@ -50,8 +50,9 @@ INT FASTCALL REGION_Complexity(PROSRGNDATA);
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 */

View file

@ -416,9 +416,9 @@ IntDispatchMessage(PMSG pMsg)
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;
}

View file

@ -190,12 +190,9 @@ IntAttachMonitor(IN PDEVOBJ *pGdiDevice,
Monitor->rcWork = Monitor->rcMonitor;
Monitor->cWndStack = 0;
Monitor->hrgnMonitor= NtGdiCreateRectRgn( Monitor->rcMonitor.left,
Monitor->rcMonitor.top,
Monitor->rcMonitor.right,
Monitor->rcMonitor.bottom );
Monitor->hrgnMonitor= IntSysCreateRectRgnIndirect( &Monitor->rcMonitor );
IntGdiSetRegeionOwner(Monitor->hrgnMonitor, GDI_OBJ_HMGR_PUBLIC);
IntGdiSetRegionOwner(Monitor->hrgnMonitor, GDI_OBJ_HMGR_PUBLIC);
if (gMonitorList == NULL)
{

View file

@ -106,9 +106,9 @@ IntCalcWindowRgn(PWINDOW_OBJECT Window, BOOL Client)
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 @@ IntGetNCUpdateRgn(PWINDOW_OBJECT Window, BOOL Validate)
hRgnWindow = IntCalcWindowRgn(Window, TRUE);
if (hRgnWindow == NULL)
{
GreDeleteObject(hRgnNonClient);
REGION_FreeRgnByHandle(hRgnNonClient);
return (HRGN)1;
}
@ -171,14 +171,14 @@ IntGetNCUpdateRgn(PWINDOW_OBJECT Window, BOOL Validate)
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 @@ IntGetNCUpdateRgn(PWINDOW_OBJECT Window, BOOL Validate)
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 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
{
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 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
{
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 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
{
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 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
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 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags)
/*
* 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 @@ co_UserRedrawWindow(PWINDOW_OBJECT Window, const RECTL* UpdateRect, HRGN UpdateR
{
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 @@ co_UserRedrawWindow(PWINDOW_OBJECT Window, const RECTL* UpdateRect, HRGN UpdateR
{
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 @@ co_UserRedrawWindow(PWINDOW_OBJECT Window, const RECTL* UpdateRect, HRGN UpdateR
(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 @@ co_UserRedrawWindow(PWINDOW_OBJECT Window, const RECTL* UpdateRect, HRGN UpdateR
if (hRgn != NULL)
{
GreDeleteObject(hRgn);
REGION_FreeRgnByHandle(hRgn);
}
return TRUE;
@ -797,7 +797,7 @@ NtUserBeginPaint(HWND hWnd, PAINTSTRUCT* UnsafePs)
{
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 @@ UserScrollDC(HDC hDC, INT dx, INT dy, const RECTL *prcScroll,
}
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 @@ UserScrollDC(HDC hDC, INT dx, INT dy, const RECTL *prcScroll,
NtGdiOffsetRgn(hrgnTmp, dx, dy);
Result = NtGdiCombineRgn(hrgnOwn, hrgnOwn, hrgnTmp, RGN_DIFF);
GreDeleteObject(hrgnTmp);
REGION_FreeRgnByHandle(hrgnTmp);
if (prcUpdate)
{
@ -1199,7 +1199,7 @@ UserScrollDC(HDC hDC, INT dx, INT dy, const RECTL *prcScroll,
if (!hrgnUpdate)
{
GreDeleteObject(hrgnOwn);
REGION_FreeRgnByHandle(hrgnOwn);
}
}
else
@ -1366,7 +1366,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *prcUnsafeScroll,
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 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *prcUnsafeScroll,
* 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);
REGION_FreeRgnByHandle(hrgnClip);
}
GreDeleteObject(hrgnTemp);
REGION_FreeRgnByHandle(hrgnTemp);
if (flags & SW_SCROLLCHILDREN)
{
@ -1468,7 +1468,7 @@ NtUserScrollWindowEx(HWND hWnd, INT dx, INT dy, const RECT *prcUnsafeScroll,
CLEANUP:
if (hrgnOwn && !hrgnUpdate)
{
GreDeleteObject(hrgnOwn);
REGION_FreeRgnByHandle(hrgnOwn);
}
if (Window)

View file

@ -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 @@ VIS_ComputeVisibleRegion(
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 @@ VIS_ComputeVisibleRegion(
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 @@ VIS_ComputeVisibleRegion(
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 @@ VIS_ComputeVisibleRegion(
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 @@ VIS_ComputeVisibleRegion(
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 @@ VIS_ComputeVisibleRegion(
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 @@ co_VIS_WindowLayoutChanged(
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 @@ co_VIS_WindowLayoutChanged(
RDW_ALLCHILDREN);
UserDerefObjectCo(Parent);
}
GreDeleteObject(Temp);
REGION_FreeRgnByHandle(Temp);
}
/* EOF */

View file

@ -63,7 +63,7 @@ DceGetVisRgn(PWINDOW_OBJECT Window, ULONG Flags, HWND hWndChild, ULONG CFlags)
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 @@ DceDeleteClipRgn(DCE* Dce)
}
else if (Dce->hrgnClip != NULL)
{
GreDeleteObject(Dce->hrgnClip);
REGION_FreeRgnByHandle(Dce->hrgnClip);
}
Dce->hrgnClip = NULL;
@ -274,7 +274,7 @@ DceUpdateVisRgn(DCE *Dce, PWINDOW_OBJECT Window, ULONG Flags)
DesktopWindow = UserGetWindowObject(IntGetDesktopWindow());
if (NULL != DesktopWindow)
{
hRgnVisible = UnsafeIntCreateRectRgnIndirect(&DesktopWindow->Wnd->rcWindow);
hRgnVisible = IntSysCreateRectRgnIndirect(&DesktopWindow->Wnd->rcWindow);
}
else
{
@ -297,9 +297,9 @@ noparent:
{
if(hRgnVisible != NULL)
{
GreDeleteObject(hRgnVisible);
REGION_FreeRgnByHandle(hRgnVisible);
}
hRgnVisible = NtGdiCreateRectRgn(0, 0, 0, 0);
hRgnVisible = IntSysCreateRectRgn(0, 0, 0, 0);
}
}
@ -318,7 +318,7 @@ noparent:
if (hRgnVisible != NULL)
{
GreDeleteObject(hRgnVisible);
REGION_FreeRgnByHandle(hRgnVisible);
}
}
@ -526,7 +526,7 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
if (!(Flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) && ClipRegion)
{
if (!(Flags & DCX_KEEPCLIPRGN))
GreDeleteObject(ClipRegion);
REGION_FreeRgnByHandle(ClipRegion);
ClipRegion = NULL;
}
@ -550,11 +550,11 @@ UserGetDCEx(PWINDOW_OBJECT Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
{
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 @@ DceFreeDCE(PDCE pdce, BOOLEAN Force)
if (pdce->hrgnClip && ! (pdce->DCXFlags & DCX_KEEPCLIPRGN))
{
GreDeleteObject(pdce->hrgnClip);
REGION_FreeRgnByHandle(pdce->hrgnClip);
}
RemoveEntryList(&pdce->List);

View file

@ -4553,7 +4553,7 @@ IntGetWindowRgn(PWINDOW_OBJECT Window, HRGN hRgn)
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 @@ IntGetWindowRgn(PWINDOW_OBJECT Window, HRGN hRgn)
else
Ret = ERROR;
GreDeleteObject(VisRgn);
REGION_FreeRgnByHandle(VisRgn);
return Ret;
}
@ -4594,7 +4594,7 @@ IntGetWindowRgnBox(PWINDOW_OBJECT Window, RECTL *Rect)
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 @@ IntGetWindowRgnBox(PWINDOW_OBJECT Window, RECTL *Rect)
else
Ret = ERROR;
GreDeleteObject(VisRgn);
REGION_FreeRgnByHandle(VisRgn);
return Ret;
}

View file

@ -1135,7 +1135,7 @@ co_WinPosSetWindowPos(
((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 @@ co_WinPosSetWindowPos(
{
/* 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 @@ co_WinPosSetWindowPos(
/* 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 @@ co_WinPosSetWindowPos(
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_WinPosSetWindowPos(
{
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))

View file

@ -27,8 +27,13 @@ CLIPPING_UpdateGCRegion(DC* Dc)
{
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 @@ GdiSelectVisRgn(HDC hdc, HRGN hrgn)
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 @@ int FASTCALL GdiExtSelectClipRgn(PDC dc,
{
if (dc->rosdc.hClipRgn != NULL)
{
GreDeleteObject(dc->rosdc.hClipRgn);
REGION_FreeRgnByHandle(dc->rosdc.hClipRgn);
dc->rosdc.hClipRgn = NULL;
}
}
@ -127,11 +132,11 @@ int FASTCALL GdiExtSelectClipRgn(PDC dc,
{
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 @@ int APIENTRY NtGdiExcludeClipRect(HDC hDC,
IntLPtoDP(dc, (LPPOINT)&Rect, 2);
NewRgn = UnsafeIntCreateRectRgnIndirect(&Rect);
NewRgn = IntSysCreateRectRgnIndirect(&Rect);
if (!NewRgn)
{
Result = ERROR;
@ -254,7 +259,7 @@ int APIENTRY NtGdiExcludeClipRect(HDC hDC,
{
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 @@ int APIENTRY NtGdiExcludeClipRect(HDC hDC,
{
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 @@ int APIENTRY NtGdiIntersectClipRect(HDC hDC,
IntLPtoDP(dc, (LPPOINT)&Rect, 2);
NewRgn = UnsafeIntCreateRectRgnIndirect(&Rect);
NewRgn = IntSysCreateRectRgnIndirect(&Rect);
if (!NewRgn)
{
Result = ERROR;
@ -312,7 +317,7 @@ int APIENTRY NtGdiIntersectClipRect(HDC hDC,
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 @@ IntGdiSetMetaRgn(PDC pDC)
{
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 @@ NEW_CLIPPING_UpdateGCRegion(PDC pDC)
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)

View file

@ -332,7 +332,7 @@ IntGdiCreateDC(
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 @@ IntGdiCreateDC(
if (hVisRgn)
{
GdiSelectVisRgn(hdc, hVisRgn);
GreDeleteObject(hVisRgn);
REGION_FreeRgnByHandle(hVisRgn);
}
IntGdiSetTextAlign(hdc, TA_TOP);
@ -686,11 +686,11 @@ NtGdiCreateCompatibleDC(HDC hDC)
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);

View file

@ -298,10 +298,10 @@ NtGdiSelectBitmap(
}
/* 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 @@ NtGdiSelectBitmap(
if (hVisRgn)
{
GdiSelectVisRgn(hDC, hVisRgn);
GreDeleteObject(hVisRgn);
REGION_FreeRgnByHandle(hVisRgn);
}
return hOrgBmp;

View file

@ -695,7 +695,7 @@ bPEBCacheHandle(HGDIOBJ Handle, int oType, PVOID pAttr)
hPtr = GdiHandleCache->Handle + Offset;
if ( oType == hctRegionHandle)
if ( pAttr && oType == hctRegionHandle)
{
if ( Number < CACHE_REGION_ENTRIES )
{
@ -746,14 +746,17 @@ GreDeleteObject(HGDIOBJ hObject)
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 @@ GDI_MapHandleTable(PSECTION_OBJECT SectionObject, PEPROCESS Process)
BOOL
FASTCALL
IntGdiSetRegeionOwner(HRGN hRgn, DWORD OwnerMask)
IntGdiSetRegionOwner(HRGN hRgn, DWORD OwnerMask)
{
INT Index;
PGDI_TABLE_ENTRY Entry;

View file

@ -2189,19 +2189,6 @@ RGNOBJAPI_Unlock(PROSRGNDATA pRgn)
//
// 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 @@ IntGdiPaintRgn(
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 @@ IntGdiPaintRgn(
visrgn = RGNOBJAPI_Lock(tmpVisRgn, NULL);
if (visrgn == NULL)
{
GreDeleteObject(tmpVisRgn);
REGION_FreeRgnByHandle(tmpVisRgn);
return FALSE;
}
@ -2466,7 +2453,7 @@ IntGdiPaintRgn(
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 @@ NtGdiFrameRgn(
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;
}