2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2008-02-26 01:00:34 +00:00
|
|
|
/* Type definitions ***********************************************************/
|
|
|
|
|
|
|
|
/* Internal region data.
|
|
|
|
Can't use RGNDATA structure because buffer is allocated statically */
|
2014-12-18 08:11:19 +00:00
|
|
|
typedef struct _REGION
|
2008-02-26 01:00:34 +00:00
|
|
|
{
|
|
|
|
/* Header for all gdi objects in the handle table.
|
|
|
|
Do not (re)move this. */
|
2014-12-18 08:12:01 +00:00
|
|
|
BASEOBJECT BaseObject;
|
2015-03-10 00:11:29 +00:00
|
|
|
_Notnull_ PRGN_ATTR prgnattr;
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
RGN_ATTR rgnattr;
|
2007-11-30 12:16:32 +00:00
|
|
|
|
2006-11-08 11:47:44 +00:00
|
|
|
RGNDATAHEADER rdh;
|
2014-12-18 08:12:01 +00:00
|
|
|
RECTL *Buffer;
|
2014-12-18 08:11:19 +00:00
|
|
|
} REGION, *PREGION;
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2014-12-18 08:12:01 +00:00
|
|
|
/* Globals ********************************************************************/
|
|
|
|
|
|
|
|
extern PREGION prgnDefault;
|
|
|
|
extern HRGN hrgnDefault;
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2008-02-26 01:00:34 +00:00
|
|
|
/* Functions ******************************************************************/
|
|
|
|
|
2014-12-18 08:11:19 +00:00
|
|
|
PREGION FASTCALL REGION_AllocRgnWithHandle(INT n);
|
|
|
|
PREGION FASTCALL REGION_AllocUserRgnWithHandle(INT n);
|
2019-04-17 19:43:24 +00:00
|
|
|
BOOL FASTCALL REGION_UnionRectWithRgn(PREGION rgn, const RECTL *rect);
|
2014-09-24 21:23:03 +00:00
|
|
|
INT FASTCALL REGION_SubtractRectFromRgn(PREGION prgnDest, PREGION prgnSrc, const RECTL *prcl);
|
2014-12-18 08:11:19 +00:00
|
|
|
INT FASTCALL REGION_GetRgnBox(PREGION Rgn, RECTL *pRect);
|
|
|
|
BOOL FASTCALL REGION_RectInRegion(PREGION Rgn, const RECTL *rc);
|
2014-07-23 16:05:47 +00:00
|
|
|
BOOL FASTCALL REGION_PtInRegion(PREGION, INT, INT);
|
2014-12-18 08:11:31 +00:00
|
|
|
INT FASTCALL REGION_CropRegion(PREGION rgnDst, PREGION rgnSrc, const RECTL *rect);
|
2014-12-18 08:11:19 +00:00
|
|
|
VOID FASTCALL REGION_SetRectRgn(PREGION pRgn, INT LeftRect, INT TopRect, INT RightRect, INT BottomRect);
|
2014-05-22 11:45:53 +00:00
|
|
|
VOID NTAPI REGION_vCleanup(PVOID ObjectBody);
|
2014-12-18 08:11:19 +00:00
|
|
|
VOID FASTCALL REGION_Delete(PREGION);
|
2009-03-19 01:42:34 +00:00
|
|
|
INT APIENTRY IntGdiGetRgnBox(HRGN, RECTL*);
|
2014-12-18 08:11:56 +00:00
|
|
|
|
2014-12-19 10:34:52 +00:00
|
|
|
PREGION
|
|
|
|
FASTCALL
|
|
|
|
REGION_LockRgn(
|
|
|
|
_In_ HRGN hrgn);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
FASTCALL
|
|
|
|
REGION_UnlockRgn(
|
|
|
|
_In_ PREGION prgn);
|
|
|
|
|
2014-12-18 08:12:06 +00:00
|
|
|
BOOL
|
|
|
|
FASTCALL
|
|
|
|
REGION_bXformRgn(
|
|
|
|
_Inout_ PREGION prgn,
|
|
|
|
_In_ PMATRIX pmx);
|
|
|
|
|
2014-12-18 08:11:56 +00:00
|
|
|
BOOL
|
|
|
|
FASTCALL
|
|
|
|
REGION_SetPolyPolygonRgn(
|
|
|
|
_Inout_ PREGION prgn,
|
|
|
|
_In_ const POINT *ppt,
|
|
|
|
_In_ const ULONG *pcPoints,
|
|
|
|
_In_ ULONG cPolygons,
|
|
|
|
_In_ INT iMode);
|
|
|
|
|
|
|
|
HRGN
|
|
|
|
NTAPI
|
|
|
|
GreCreatePolyPolygonRgn(
|
|
|
|
_In_ const POINT *ppt,
|
|
|
|
_In_ const ULONG *pcPoints,
|
|
|
|
_In_ ULONG cPolygons,
|
|
|
|
_In_ INT iMode);
|
|
|
|
|
2014-12-18 08:12:41 +00:00
|
|
|
BOOL
|
|
|
|
FASTCALL
|
|
|
|
REGION_bOffsetRgn(
|
|
|
|
_Inout_ PREGION prgn,
|
|
|
|
_In_ INT cx,
|
|
|
|
_In_ INT cy);
|
|
|
|
|
2011-03-21 02:20:24 +00:00
|
|
|
BOOL FASTCALL IntRectInRegion(HRGN,LPRECTL);
|
2008-03-17 22:17:48 +00:00
|
|
|
|
2014-12-18 08:11:19 +00:00
|
|
|
INT FASTCALL IntGdiCombineRgn(PREGION, PREGION, PREGION, INT);
|
|
|
|
INT FASTCALL REGION_Complexity(PREGION);
|
|
|
|
PREGION FASTCALL IntSysCreateRectpRgn(INT,INT,INT,INT);
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
BOOL FASTCALL IntGdiSetRegionOwner(HRGN,DWORD);
|
2008-05-21 22:32:13 +00:00
|
|
|
|
2014-12-18 08:11:50 +00:00
|
|
|
HRGN
|
2014-12-18 08:11:42 +00:00
|
|
|
FASTCALL
|
|
|
|
GreCreateFrameRgn(
|
2014-12-18 08:11:50 +00:00
|
|
|
HRGN hrgn,
|
2014-12-18 08:11:42 +00:00
|
|
|
INT x,
|
|
|
|
INT y);
|
|
|
|
|
2010-01-25 01:33:01 +00:00
|
|
|
#define IntSysCreateRectpRgnIndirect(prc) \
|
|
|
|
IntSysCreateRectpRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom)
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
|
2019-04-17 19:43:24 +00:00
|
|
|
#define GreCreateRectRgnIndirect(prc) \
|
|
|
|
NtGdiCreateRectRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom)
|
|
|
|
|
|
|
|
#define GreSetRectRgnIndirect(hRgn, prc) \
|
|
|
|
NtGdiSetRectRgn(hRgn, (prc)->left, (prc)->top, (prc)->right, (prc)->bottom);
|
|
|
|
|
2014-12-18 08:11:19 +00:00
|
|
|
PREGION
|
[WIN32K]
Rewrite of the GDI handle manager
- The old handle manager used a completely retarded spinlock in combination with KeDelayExecutionThread() for both exclusive
and shared locks. This is probably the most uneffective algorithm possible. It was also duplicating code everywhere and it was a overall mess It
is now replaced with a lock-free reference counter for shared locks and a pushlock for exclusive locks. -> Better performance and scalability.
- Allocate user mode object attributes from the new gdi pool. This way, we don't need any caching, since the pool serves as a cache. Its also
much faster and uses much less memory.
- Allow object allocations of different size, instead of fixed size from a table. This way a single allocation can take care of actual needs.
- Allow allcoating objects without a handle and insert them into the handle table later
- Properly synchronize the process GDIHandleCount. Now gdiview and taskmanager show the correct number of gdi handles.
- Implement a new event tracking system, that is capable of tracking all reverences and locks of objects and pool allocations to help track
possible leaks
- Make sure that all objects of a process are deleted in cleanup
- Make sure all usermode memory allocations are freed, when cleaning up the process pool.
- Make sure that each object type is using the correct type of lock (either shared or exclusive, not a mixture)
- Fix some object / reference leaks
- Lots of inferface improvements
- Use global variables for certain things instead of members in the mapped gdi handle table
- Make IntSysCreateRectpRgn create a region without a handle
- Fix detection od source and mask use in GreStretchBltMask
- Use GDIOBJ_bLockMultipleObjects in NtGdiCombineRegion to avoid possible deadlocks
- Fix NtGdiAbortPath to reset DCPATH_ACTIVE flag in the dc and only bail out on error, instead of always
- Replace DC_AllocateDcAttr and DC_AllocDcAttr with DC_bAllocDcAttr using the new user mode pool
- Remove DCU_SyncDcAttrtoUser and DCU_SynchDcAttrtoUser. Those functions were unused and didn't do anything useful anyway,
- Replace IntGdiSetDCOwnerEx and DC_SetOwnership with GreSetDCOwner, remove unused NoSetBrush parameter
- Replace GDIOBJ_bValidateHandle and IsObjectDead with GreIsHandleValid
- Chage GDIOBJ_bLockMultipleObjects: pass object type, return a BOOL, whether all objects could be locked, cleanup on failure
svn path=/trunk/; revision=51470
2011-04-28 08:26:46 +00:00
|
|
|
FASTCALL
|
|
|
|
IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect);
|