2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2006-11-08 11:47:44 +00:00
|
|
|
|
|
|
|
/* Internal interface */
|
|
|
|
|
|
|
|
#define NB_HATCH_STYLES 6
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The layout of this structure is taken from "Windows Graphics Programming"
|
|
|
|
* book written by Feng Yuan.
|
|
|
|
*
|
|
|
|
* DON'T MODIFY THIS STRUCTURE UNLESS REALLY NEEDED AND EVEN THEN ASK ON
|
|
|
|
* A MAILING LIST FIRST.
|
|
|
|
*/
|
2015-03-25 22:32:48 +00:00
|
|
|
typedef struct _BRUSHBODY
|
2006-11-08 11:47:44 +00:00
|
|
|
{
|
2015-02-11 21:33:50 +00:00
|
|
|
ULONG iHatch; // This is not the brush style, but the hatch style!
|
|
|
|
HBITMAP hbmPattern;
|
|
|
|
HBITMAP hbmClient;
|
|
|
|
ULONG flAttrs;
|
|
|
|
|
|
|
|
ULONG ulBrushUnique;
|
|
|
|
BRUSH_ATTR *pBrushAttr; // Pointer to the currently active brush attribute
|
|
|
|
BRUSH_ATTR BrushAttr; // Internal brush attribute for global brushes
|
|
|
|
POINT ptOrigin;
|
|
|
|
ULONG bCacheGrabbed;
|
|
|
|
COLORREF crBack;
|
|
|
|
COLORREF crFore;
|
|
|
|
ULONG ulPalTime;
|
|
|
|
ULONG ulSurfTime;
|
|
|
|
PVOID pvRBrush;
|
|
|
|
HDEV hdev;
|
|
|
|
//DWORD unk054;
|
2015-03-25 22:32:48 +00:00
|
|
|
|
|
|
|
/* The following members are for PENs only */
|
2015-02-11 21:33:50 +00:00
|
|
|
LONG lWidth;
|
2017-05-06 12:18:21 +00:00
|
|
|
FLOATOBJ eWidth;
|
2015-02-11 21:33:50 +00:00
|
|
|
ULONG ulPenStyle;
|
|
|
|
DWORD *pStyle;
|
|
|
|
ULONG dwStyleCount;
|
|
|
|
BYTE jJoin; // 0x06c Join styles for geometric wide lines
|
|
|
|
BYTE jEndCap; // end cap style for a geometric wide line
|
|
|
|
//WORD unk06e; // 0x06e
|
|
|
|
INT iBrushStyle; // 0x070
|
|
|
|
//PREGION prgn; // 0x074
|
|
|
|
//DWORD unk078; // 0x078
|
2015-12-17 17:44:42 +00:00
|
|
|
//DWORD unk07c; // 0x07c
|
|
|
|
ULONG ulStyleSize;
|
2015-02-11 21:33:50 +00:00
|
|
|
LIST_ENTRY ListHead; // 0x080
|
2015-03-25 22:32:48 +00:00
|
|
|
} BRUSHBODY;
|
|
|
|
|
|
|
|
#ifndef __cplusplus
|
|
|
|
typedef struct _BRUSH
|
|
|
|
{
|
|
|
|
/* Header for all gdi objects in the handle table.
|
|
|
|
Do not (re)move this. */
|
|
|
|
BASEOBJECT BaseObject;
|
|
|
|
|
|
|
|
BRUSHBODY;
|
2009-03-20 22:40:14 +00:00
|
|
|
} BRUSH, *PBRUSH;
|
2015-03-25 22:32:48 +00:00
|
|
|
#else
|
|
|
|
class BRUSH;
|
|
|
|
typedef class BRUSH *PBRUSH;
|
|
|
|
#endif
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2009-03-23 00:38:59 +00:00
|
|
|
typedef struct _EBRUSHOBJ
|
2006-11-08 11:47:44 +00:00
|
|
|
{
|
2009-03-23 00:38:59 +00:00
|
|
|
BRUSHOBJ BrushObject;
|
|
|
|
|
|
|
|
COLORREF crRealize;
|
|
|
|
ULONG ulRGBColor;
|
2009-03-29 01:43:09 +00:00
|
|
|
PVOID pengbrush;
|
2009-03-23 00:38:59 +00:00
|
|
|
ULONG ulSurfPalTime;
|
|
|
|
ULONG ulDCPalTime;
|
|
|
|
COLORREF crCurrentText;
|
|
|
|
COLORREF crCurrentBack;
|
|
|
|
COLORADJUSTMENT *pca;
|
|
|
|
// DWORD dwUnknown2c;
|
|
|
|
// DWORD dwUnknown30;
|
|
|
|
SURFACE * psurfTrg;
|
2009-08-04 20:37:10 +00:00
|
|
|
struct _PALETTE * ppalSurf;
|
2012-05-05 21:39:35 +00:00
|
|
|
struct _PALETTE * ppalDC;
|
|
|
|
struct _PALETTE * ppalDIB;
|
2009-03-23 00:38:59 +00:00
|
|
|
// DWORD dwUnknown44;
|
2015-03-25 22:32:48 +00:00
|
|
|
PBRUSH pbrush;
|
2009-03-23 00:38:59 +00:00
|
|
|
FLONG flattrs;
|
|
|
|
DWORD ulUnique;
|
|
|
|
// DWORD dwUnknown54;
|
|
|
|
// DWORD dwUnknown58;
|
2015-02-11 21:34:11 +00:00
|
|
|
|
|
|
|
SURFOBJ *psoMask;
|
2009-03-20 22:40:14 +00:00
|
|
|
} EBRUSHOBJ, *PEBRUSHOBJ;
|
2006-11-08 11:47:44 +00:00
|
|
|
|
|
|
|
/* GDI Brush Attributes */
|
2012-05-04 17:37:07 +00:00
|
|
|
#define BR_NEED_FG_CLR 0x00000001
|
|
|
|
#define BR_NEED_BK_CLR 0x00000002 /* Background color is needed */
|
|
|
|
#define BR_DITHER_OK 0x00000004 /* Allow color dithering */
|
|
|
|
#define BR_IS_SOLID 0x00000010 /* Solid brush */
|
|
|
|
#define BR_IS_HATCH 0x00000020 /* Hatch brush */
|
|
|
|
#define BR_IS_BITMAP 0x00000040 /* DDB pattern brush */
|
|
|
|
#define BR_IS_DIB 0x00000080 /* DIB pattern brush */
|
|
|
|
#define BR_IS_NULL 0x00000100 /* Null/hollow brush */
|
|
|
|
#define BR_IS_GLOBAL 0x00000200 /* Stock objects */
|
|
|
|
#define BR_IS_PEN 0x00000400 /* Pen */
|
|
|
|
#define BR_IS_OLDSTYLEPEN 0x00000800 /* Geometric pen */
|
|
|
|
#define BR_IS_DIBPALCOLORS 0x00001000
|
2015-03-25 22:27:05 +00:00
|
|
|
#define BR_IS_DIBPALINDICES 0x00002000
|
2012-05-04 17:37:07 +00:00
|
|
|
#define BR_IS_DEFAULTSTYLE 0x00004000
|
|
|
|
#define BR_IS_MASKING 0x00008000 /* Pattern bitmap is used as transparent mask (?) */
|
|
|
|
#define BR_IS_INSIDEFRAME 0x00010000
|
|
|
|
#define BR_CACHED_ENGINE 0x00040000
|
|
|
|
#define BR_CACHED_IS_SOLID 0x80000000
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2009-03-23 00:38:59 +00:00
|
|
|
#define BRUSH_ShareLockBrush(hBrush) ((PBRUSH)GDIOBJ_ShareLockObj((HGDIOBJ)hBrush, GDI_OBJECT_TYPE_BRUSH))
|
[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
|
|
|
#define BRUSH_ShareUnlockBrush(pBrush) GDIOBJ_vDereferenceObject((POBJ)pBrush)
|
2009-03-23 00:38:59 +00:00
|
|
|
|
2015-02-11 21:33:50 +00:00
|
|
|
INT
|
|
|
|
FASTCALL
|
|
|
|
BRUSH_GetObject(
|
|
|
|
PBRUSH GdiObject,
|
|
|
|
INT Count,
|
|
|
|
LPLOGBRUSH Buffer);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
2015-03-25 22:32:48 +00:00
|
|
|
BRUSH_vDeleteObject(
|
|
|
|
PVOID pvObject);
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2012-05-06 08:17:48 +00:00
|
|
|
extern HSURF gahsurfHatch[HS_DDI_MAX];
|
|
|
|
|
2012-10-18 18:23:47 +00:00
|
|
|
struct _SURFACE;
|
|
|
|
struct _PALETTE;
|
2009-07-10 23:44:05 +00:00
|
|
|
struct _DC;
|
|
|
|
|
2012-05-06 08:17:48 +00:00
|
|
|
INIT_FUNCTION
|
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
InitBrushImpl(VOID);
|
|
|
|
|
2009-07-10 23:44:05 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2012-10-18 18:23:47 +00:00
|
|
|
EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _SURFACE *, COLORREF, COLORREF, struct _PALETTE *);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
EBRUSHOBJ_vInitFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *);
|
2009-03-21 00:25:52 +00:00
|
|
|
|
2009-03-23 00:38:59 +00:00
|
|
|
VOID
|
|
|
|
FASTCALL
|
2012-04-26 16:19:22 +00:00
|
|
|
EBRUSHOBJ_vSetSolidRGBColor(EBRUSHOBJ *pebo, COLORREF crColor);
|
2009-03-23 00:38:59 +00:00
|
|
|
|
|
|
|
VOID
|
2009-07-10 23:44:05 +00:00
|
|
|
NTAPI
|
2012-10-18 18:23:47 +00:00
|
|
|
EBRUSHOBJ_vUpdateFromDC(EBRUSHOBJ *pebo, PBRUSH pbrush, struct _DC *);
|
2009-03-23 00:38:59 +00:00
|
|
|
|
|
|
|
BOOL
|
2009-07-10 23:44:05 +00:00
|
|
|
NTAPI
|
2009-07-11 01:19:39 +00:00
|
|
|
EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo, BOOL bCallDriver);
|
2009-03-23 00:38:59 +00:00
|
|
|
|
2009-07-10 23:44:05 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo);
|
|
|
|
|
2009-07-11 20:15:37 +00:00
|
|
|
PVOID
|
|
|
|
NTAPI
|
|
|
|
EBRUSHOBJ_pvGetEngBrush(EBRUSHOBJ *pebo);
|
|
|
|
|
2012-03-24 17:19:34 +00:00
|
|
|
SURFOBJ*
|
|
|
|
NTAPI
|
|
|
|
EBRUSHOBJ_psoPattern(EBRUSHOBJ *pebo);
|
|
|
|
|
|
|
|
#define BRUSHOBJ_psoPattern(pbo) \
|
|
|
|
EBRUSHOBJ_psoPattern(CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject))
|
|
|
|
|
2015-02-11 21:34:11 +00:00
|
|
|
SURFOBJ*
|
|
|
|
NTAPI
|
|
|
|
EBRUSHOBJ_psoMask(EBRUSHOBJ *pebo);
|
|
|
|
|
|
|
|
#define BRUSHOBJ_psoMask(pbo) \
|
|
|
|
EBRUSHOBJ_psoMask(CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject))
|
|
|
|
|
2012-04-26 16:19:22 +00:00
|
|
|
FORCEINLINE
|
2014-05-04 09:45:42 +00:00
|
|
|
ULONG
|
2012-04-26 16:19:22 +00:00
|
|
|
EBRUSHOBJ_iSetSolidColor(EBRUSHOBJ *pebo, ULONG iSolidColor)
|
|
|
|
{
|
|
|
|
ULONG iOldColor = pebo->BrushObject.iSolidColor;
|
|
|
|
pebo->BrushObject.iSolidColor = iSolidColor;
|
|
|
|
return iOldColor;
|
|
|
|
}
|
|
|
|
|
2010-01-21 01:39:19 +00:00
|
|
|
BOOL FASTCALL IntGdiSetBrushOwner(PBRUSH,DWORD);
|
2011-05-21 06:34:02 +00:00
|
|
|
BOOL FASTCALL GreSetBrushOwner(HBRUSH,DWORD);
|
|
|
|
|
2012-05-02 18:55:23 +00:00
|
|
|
HBRUSH APIENTRY
|
|
|
|
IntGdiCreatePatternBrush(
|
|
|
|
HBITMAP hBitmap);
|
|
|
|
|
|
|
|
HBRUSH APIENTRY
|
|
|
|
IntGdiCreateSolidBrush(
|
|
|
|
COLORREF Color);
|
|
|
|
|
|
|
|
HBRUSH APIENTRY
|
|
|
|
IntGdiCreateNullBrush(VOID);
|
|
|
|
|
2015-03-25 22:32:48 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
IntGdiSetSolidBrushColor(
|
|
|
|
_In_ HBRUSH hbr,
|
|
|
|
_In_ COLORREF crColor);
|