Author: tkreuzer
Date: Wed Mar 25 22:32:48 2015
New Revision: 66891
URL:
http://svn.reactos.org/svn/reactos?rev=66891&view=rev
Log:
[WIN32K]
- Make brush structure definition C++ compatible
- Add delete callback for GDI objects and use if for brushes.
- Make IntGdiSetSolidBrushColor NTAPI instead of FASTCALL
Modified:
trunk/reactos/win32ss/gdi/ntgdi/brush.c
trunk/reactos/win32ss/gdi/ntgdi/brush.h
trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c
trunk/reactos/win32ss/gdi/ntgdi/gdiobj.h
Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.c?…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/brush.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/brush.c [iso-8859-1] Wed Mar 25 22:32:48 2015
@@ -154,6 +154,16 @@
}
}
+VOID
+NTAPI
+BRUSH_vDeleteObject(
+ PVOID pvObject)
+{
+ BRUSH_vCleanup(pvObject);
+ ExFreePoolWithTag(pvObject, GDITAG_HMGR_BRUSH_TYPE);
+}
+
+
INT
FASTCALL
BRUSH_GetObject(PBRUSH pbrush, INT cjSize, LPLOGBRUSH plogbrush)
@@ -385,7 +395,7 @@
}
VOID
-FASTCALL
+NTAPI
IntGdiSetSolidBrushColor(HBRUSH hBrush, COLORREF Color)
{
PBRUSH pbrush;
Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.h?…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] Wed Mar 25 22:32:48 2015
@@ -11,12 +11,8 @@
* DON'T MODIFY THIS STRUCTURE UNLESS REALLY NEEDED AND EVEN THEN ASK ON
* A MAILING LIST FIRST.
*/
-typedef struct _BRUSH
-{
- /* Header for all gdi objects in the handle table.
- Do not (re)move this. */
- BASEOBJECT BaseObject;
-
+typedef struct _BRUSHBODY
+{
ULONG iHatch; // This is not the brush style, but the hatch style!
HBITMAP hbmPattern;
HBITMAP hbmClient;
@@ -34,6 +30,8 @@
PVOID pvRBrush;
HDEV hdev;
//DWORD unk054;
+
+ /* The following members are for PENs only */
LONG lWidth;
FLOAT eWidth;
ULONG ulPenStyle;
@@ -47,7 +45,21 @@
//DWORD unk078; // 0x078
DWORD unk07c; // 0x07c
LIST_ENTRY ListHead; // 0x080
+} BRUSHBODY;
+
+#ifndef __cplusplus
+typedef struct _BRUSH
+{
+ /* Header for all gdi objects in the handle table.
+ Do not (re)move this. */
+ BASEOBJECT BaseObject;
+
+ BRUSHBODY;
} BRUSH, *PBRUSH;
+#else
+class BRUSH;
+typedef class BRUSH *PBRUSH;
+#endif
typedef struct _EBRUSHOBJ
{
@@ -68,7 +80,7 @@
struct _PALETTE * ppalDC;
struct _PALETTE * ppalDIB;
// DWORD dwUnknown44;
- BRUSH * pbrush;
+ PBRUSH pbrush;
FLONG flattrs;
DWORD ulUnique;
// DWORD dwUnknown54;
@@ -109,8 +121,8 @@
VOID
NTAPI
-BRUSH_vCleanup(
- PVOID ObjectBody);
+BRUSH_vDeleteObject(
+ PVOID pvObject);
extern HSURF gahsurfHatch[HS_DDI_MAX];
@@ -188,5 +200,8 @@
HBRUSH APIENTRY
IntGdiCreateNullBrush(VOID);
-VOID FASTCALL
-IntGdiSetSolidBrushColor(HBRUSH hBrush, COLORREF Color);
+VOID
+NTAPI
+IntGdiSetSolidBrushColor(
+ _In_ HBRUSH hbr,
+ _In_ COLORREF crColor);
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.c [iso-8859-1] Wed Mar 25 22:32:48 2015
@@ -159,7 +159,7 @@
NULL, /* 0d GDIObjType_PFT_TYPE, unused */
GDIOBJ_vCleanup, /* 0e GDIObjType_ICMCXF_TYPE */
NULL, /* 0f GDIObjType_SPRITE_TYPE, unused */
- BRUSH_vCleanup, /* 10 GDIObjType_BRUSH_TYPE, BRUSH, PEN, EXTPEN */
+ NULL, /* 10 GDIObjType_BRUSH_TYPE, BRUSH, PEN, EXTPEN */
NULL, /* 11 GDIObjType_UMPD_TYPE, unused */
NULL, /* 12 GDIObjType_UNUSED4_TYPE */
NULL, /* 13 GDIObjType_SPACE_TYPE, unused */
@@ -177,6 +177,44 @@
NULL, /* 1f reserved entry */
};
+static const
+GDIOBJDELETEPROC
+apfnDelete[] =
+{
+ NULL, /* 00 GDIObjType_DEF_TYPE */
+ NULL, /* 01 GDIObjType_DC_TYPE */
+ NULL, /* 02 GDIObjType_UNUSED1_TYPE */
+ NULL, /* 03 GDIObjType_UNUSED2_TYPE */
+ NULL, /* 04 GDIObjType_RGN_TYPE */
+ NULL, /* 05 GDIObjType_SURF_TYPE */
+ NULL, /* 06 GDIObjType_CLIENTOBJ_TYPE */
+ NULL, /* 07 GDIObjType_PATH_TYPE */
+ NULL, /* 08 GDIObjType_PAL_TYPE */
+ NULL, /* 09 GDIObjType_ICMLCS_TYPE */
+ NULL, /* 0a GDIObjType_LFONT_TYPE */
+ NULL, /* 0b GDIObjType_RFONT_TYPE, unused */
+ NULL, /* 0c GDIObjType_PFE_TYPE, unused */
+ NULL, /* 0d GDIObjType_PFT_TYPE, unused */
+ NULL, /* 0e GDIObjType_ICMCXF_TYPE */
+ NULL, /* 0f GDIObjType_SPRITE_TYPE, unused */
+ BRUSH_vDeleteObject, /* 10 GDIObjType_BRUSH_TYPE, BRUSH, PEN, EXTPEN */
+ NULL, /* 11 GDIObjType_UMPD_TYPE, unused */
+ NULL, /* 12 GDIObjType_UNUSED4_TYPE */
+ NULL, /* 13 GDIObjType_SPACE_TYPE, unused */
+ NULL, /* 14 GDIObjType_UNUSED5_TYPE */
+ NULL, /* 15 GDIObjType_META_TYPE, unused */
+ NULL, /* 16 GDIObjType_EFSTATE_TYPE, unused */
+ NULL, /* 17 GDIObjType_BMFD_TYPE, unused */
+ NULL, /* 18 GDIObjType_VTFD_TYPE, unused */
+ NULL, /* 19 GDIObjType_TTFD_TYPE, unused */
+ NULL, /* 1a GDIObjType_RC_TYPE, unused */
+ NULL, /* 1b GDIObjType_TEMP_TYPE, unused */
+ NULL, /* 1c GDIObjType_DRVOBJ_TYPE */
+ NULL, /* 1d GDIObjType_DCIOBJ_TYPE, unused */
+ NULL, /* 1e GDIObjType_SPOOL_TYPE, unused */
+ NULL, /* 1f reserved entry */
+};
+
/* INTERNAL FUNCTIONS ********************************************************/
static
@@ -547,18 +585,27 @@
/* Get the object type */
objt = ((ULONG_PTR)pobj->hHmgr >> 16) & 0x1f;
- /* Call the cleanup procedure */
- ASSERT(apfnCleanup[objt]);
- apfnCleanup[objt](pobj);
-
- /* Check if the object is allocated from a lookaside list */
- if (pobj->BaseFlags & BASEFLAG_LOOKASIDE)
- {
- ExFreeToPagedLookasideList(&gpaLookasideList[objt], pobj);
+ /* Check if we have a delete procedure (for C++ based objects) */
+ if (apfnDelete[objt] != NULL)
+ {
+ /* Invoke the delete procedure */
+ apfnDelete[objt](pobj);
}
else
{
- ExFreePoolWithTag(pobj, GDIOBJ_POOL_TAG(objt));
+ /* Call the cleanup procedure */
+ NT_ASSERT(apfnCleanup[objt]);
+ apfnCleanup[objt](pobj);
+
+ /* Check if the object is allocated from a lookaside list */
+ if (pobj->BaseFlags & BASEFLAG_LOOKASIDE)
+ {
+ ExFreeToPagedLookasideList(&gpaLookasideList[objt], pobj);
+ }
+ else
+ {
+ ExFreePoolWithTag(pobj, GDIOBJ_POOL_TAG(objt));
+ }
}
}
Modified: trunk/reactos/win32ss/gdi/ntgdi/gdiobj.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/gdiobj.h…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/gdiobj.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/gdiobj.h [iso-8859-1] Wed Mar 25 22:32:48 2015
@@ -31,6 +31,7 @@
typedef PVOID PGDIOBJ;
typedef VOID (NTAPI *GDICLEANUPPROC)(PVOID ObjectBody);
+typedef VOID (NTAPI *GDIOBJDELETEPROC)(PVOID ObjectBody);
/* Every GDI Object must have this standard type of header.
* It's for thread locking. */