2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * PURPOSE: Functions for creation and destruction of DCs
5 * FILE: subsystem/win32/win32k/objects/dcattr.c
6 * PROGRAMER: Timo Kreuzer (timo.kreuzer@rectos.org)
14 #define GDIDCATTRFREE 8
16 typedef struct _GDI_DC_ATTR_FREELIST
20 PVOID AttrList
[GDIDCATTRFREE
];
21 } GDI_DC_ATTR_FREELIST
, *PGDI_DC_ATTR_FREELIST
;
23 typedef struct _GDI_DC_ATTR_ENTRY
25 DC_ATTR Attr
[GDIDCATTRFREE
];
26 } GDI_DC_ATTR_ENTRY
, *PGDI_DC_ATTR_ENTRY
;
31 DC_bAllocDcAttr(PDC pdc
)
36 ppi
= PsGetCurrentProcessWin32Process();
39 pdcattr
= GdiPoolAllocate(ppi
->pPoolDcAttr
);
42 DPRINT1("Could not allocate DC attr\n");
46 /* Copy the content from the kernel mode dc attr */
47 pdc
->pdcattr
= pdcattr
;
48 *pdc
->pdcattr
= pdc
->dcattr
;
50 /* Set the object attribute in the handle table */
51 GDIOBJ_vSetObjectAttr(&pdc
->BaseObject
, pdcattr
);
53 DPRINT("DC_AllocDcAttr: pdc=%p, pdc->pdcattr=%p\n", pdc
, pdc
->pdcattr
);
59 DC_vFreeDcAttr(PDC pdc
)
63 if (pdc
->pdcattr
== &pdc
->dcattr
)
65 // Internal DC object!
69 /* Reset the object attribute in the handle table */
70 GDIOBJ_vSetObjectAttr(&pdc
->BaseObject
, NULL
);
72 ppi
= PsGetCurrentProcessWin32Process();
74 GdiPoolFree(ppi
->pPoolDcAttr
, pdc
->pdcattr
);
76 /* Reset to kmode dcattr */
77 pdc
->pdcattr
= &pdc
->dcattr
;