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 */
|
|
|
|
typedef struct _ROSRGNDATA
|
|
|
|
{
|
|
|
|
/* Header for all gdi objects in the handle table.
|
|
|
|
Do not (re)move this. */
|
|
|
|
BASEOBJECT BaseObject;
|
[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
|
|
|
PRGN_ATTR prgnattr;
|
|
|
|
RGN_ATTR rgnattr;
|
2007-11-30 12:16:32 +00:00
|
|
|
|
2006-11-08 11:47:44 +00:00
|
|
|
RGNDATAHEADER rdh;
|
2009-03-19 01:42:34 +00:00
|
|
|
RECTL *Buffer;
|
2010-03-31 22:43:02 +00:00
|
|
|
} ROSRGNDATA, *PROSRGNDATA, *LPROSRGNDATA, REGION, *PREGION;
|
2006-11-08 11:47:44 +00:00
|
|
|
|
|
|
|
|
2008-02-26 01:00:34 +00:00
|
|
|
/* Functions ******************************************************************/
|
|
|
|
|
2008-03-19 00:56:40 +00:00
|
|
|
#define REGION_FreeRgn(pRgn) GDIOBJ_FreeObj((POBJ)pRgn, GDIObjType_RGN_TYPE)
|
2008-06-23 17:57:41 +00:00
|
|
|
#define REGION_FreeRgnByHandle(hRgn) GDIOBJ_FreeObjByHandle((HGDIOBJ)hRgn, GDI_OBJECT_TYPE_REGION)
|
2008-03-17 22:17:48 +00:00
|
|
|
|
|
|
|
PROSRGNDATA FASTCALL REGION_AllocRgnWithHandle(INT n);
|
2010-01-25 01:33:01 +00:00
|
|
|
PROSRGNDATA FASTCALL REGION_AllocUserRgnWithHandle(INT n);
|
2009-03-19 01:42:34 +00:00
|
|
|
VOID FASTCALL REGION_UnionRectWithRgn(ROSRGNDATA *rgn, const RECTL *rect);
|
|
|
|
INT FASTCALL REGION_GetRgnBox(PROSRGNDATA Rgn, RECTL *pRect);
|
|
|
|
BOOL FASTCALL REGION_RectInRegion(PROSRGNDATA Rgn, const RECTL *rc);
|
|
|
|
BOOL FASTCALL REGION_CropAndOffsetRegion(PROSRGNDATA rgnDst, PROSRGNDATA rgnSrc, const RECTL *rect, const POINT *off);
|
2008-03-17 22:17:48 +00:00
|
|
|
VOID FASTCALL REGION_SetRectRgn(PROSRGNDATA pRgn, INT LeftRect, INT TopRect, INT RightRect, INT BottomRect);
|
2011-08-27 12:38:23 +00:00
|
|
|
BOOL NTAPI REGION_Cleanup(PVOID ObjectBody);
|
2008-03-17 22:17:48 +00:00
|
|
|
|
2008-06-17 05:19:08 +00:00
|
|
|
extern PROSRGNDATA prgnDefault;
|
|
|
|
extern HRGN hrgnDefault;
|
|
|
|
|
|
|
|
VOID FASTCALL REGION_Delete(PROSRGNDATA);
|
|
|
|
VOID FASTCALL IntGdiReleaseRaoRgn(PDC);
|
|
|
|
VOID FASTCALL IntGdiReleaseVisRgn(PDC);
|
|
|
|
|
2009-03-19 01:42:34 +00:00
|
|
|
INT APIENTRY IntGdiGetRgnBox(HRGN, RECTL*);
|
2007-08-21 09:28:51 +00:00
|
|
|
BOOL FASTCALL IntGdiPaintRgn(PDC, HRGN );
|
2008-10-07 23:02:41 +00:00
|
|
|
HRGN FASTCALL IntCreatePolyPolygonRgn(PPOINT, PULONG, INT, INT);
|
2010-01-25 01:33:01 +00:00
|
|
|
INT FASTCALL IntGdiOffsetRgn(PROSRGNDATA,INT,INT);
|
2011-03-21 02:20:24 +00:00
|
|
|
BOOL FASTCALL IntRectInRegion(HRGN,LPRECTL);
|
2008-03-17 22:17:48 +00:00
|
|
|
|
2008-05-21 22:32:13 +00:00
|
|
|
INT FASTCALL IntGdiCombineRgn(PROSRGNDATA, PROSRGNDATA, PROSRGNDATA, INT);
|
|
|
|
INT FASTCALL REGION_Complexity(PROSRGNDATA);
|
2009-12-29 21:07:04 +00:00
|
|
|
PROSRGNDATA FASTCALL RGNOBJAPI_Lock(HRGN,PRGN_ATTR *);
|
|
|
|
VOID FASTCALL RGNOBJAPI_Unlock(PROSRGNDATA);
|
2010-01-21 13:18:33 +00:00
|
|
|
HRGN FASTCALL IntSysCreateRectRgn(INT,INT,INT,INT);
|
2010-01-25 01:33:01 +00:00
|
|
|
PROSRGNDATA 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
|
|
|
|
2010-01-21 13:18:33 +00:00
|
|
|
#define IntSysCreateRectRgnIndirect(prc) \
|
|
|
|
IntSysCreateRectRgn((prc)->left, (prc)->top, (prc)->right, (prc)->bottom)
|
2007-08-21 09:28:51 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
PROSRGNDATA
|
|
|
|
FASTCALL
|
|
|
|
IntSysCreateRectpRgn(INT LeftRect, INT TopRect, INT RightRect, INT BottomRect);
|
|
|
|
|
|
|
|
FORCEINLINE
|
|
|
|
PREGION
|
|
|
|
REGION_LockRgn(HRGN hrgn)
|
|
|
|
{
|
|
|
|
return GDIOBJ_LockObject(hrgn, GDIObjType_RGN_TYPE);
|
|
|
|
}
|
|
|
|
|
|
|
|
FORCEINLINE
|
|
|
|
VOID
|
|
|
|
REGION_UnlockRgn(PREGION prgn)
|
|
|
|
{
|
|
|
|
GDIOBJ_vUnlockObject(&prgn->BaseObject);
|
|
|
|
}
|