ReactOS 0.4.16-dev-340-g0540c21
dc.h
Go to the documentation of this file.
1#ifndef __WIN32K_DC_H
2#define __WIN32K_DC_H
3
4/* Constants ******************************************************************/
5
6/* flFontState */
8{
12};
13
14/* fl */
15#define DC_FL_PAL_BACK 1
16
17typedef enum _DCFLAGS
18{
19 DC_DISPLAY = 0x0001,
20 DC_DIRECT = 0x0002,
21 DC_CANCELED = 0x0004,
22 DC_PERMANANT = 0x0008,
23 DC_DIRTY_RAO = 0x0010,
24 DC_ACCUM_WMGR = 0x0020,
25 DC_ACCUM_APP = 0x0040,
26 DC_RESET = 0x0080,
29 DC_TEMPINFODC = 0x0400,
30 DC_FULLSCREEN = 0x0800,
34#if DBG
35 DC_PREPARED = 0x8000
36#endif
38
39typedef enum _DCTYPE
40{
41 DCTYPE_DIRECT = 0, /* Normal device context */
42 DCTYPE_MEMORY = 1, /* Memory device context */
43 DCTYPE_INFO = 2, /* Information context */
45
46
47/* Type definitions ***********************************************************/
48
49typedef struct _DCLEVEL
50{
51 HPALETTE hpal;
52 struct _PALETTE * ppal;
53 PVOID pColorSpace; /* COLORSPACE* */
61 _Notnull_ struct _LFONT * plfnt; /* LFONT* (TEXTOBJ*) */
62 HGDIOBJ hPath; /* HPATH */
64 LINEATTRS laPath; /* 0x20 bytes */
70 UNIVERSAL_FONT_ID ufiLoc[4]; /* Local List. */
90
91/*
92 * The DC object structure.
93 * See also: https://reactos.org/wiki/Techwiki:Win32k/DC
94 */
95typedef struct _DC
96{
97 /* Header for all gdi objects in the handle table.
98 Do not (re)move this. */
100
101 DHPDEV dhpdev; /* <- PDEVOBJ.hPDev DHPDEV for device. */
105 PVOID hsem; /* PERESOURCE aka HSEMAPHORE */
119 _Notnull_ PREGION prgnVis; /* Visible region (must never be 0) */
129 PVOID prfnt; /* RFONT* */
130 XCLIPOBJ co; /* CLIPOBJ */
131 PVOID pPFFList; /* PPFF* */
138// typedef struct _DC *PDC;
139
140extern PDC defaultDCstate;
141
142/* Internal functions *********************************************************/
143
144/* dcobjs.c */
145
150
151HFONT
152NTAPI
154 _In_ PDC pdc,
155 _In_ HFONT hlfntNew);
156
157HPALETTE
158NTAPI
160 _In_ HDC hDC,
161 _In_ HPALETTE hpal,
162 _In_ BOOL ForceBackground);
163
164/* dcutil.c */
165
169 _In_ HDC hDC,
171
172INT FASTCALL IntGdiSetBkMode(HDC hDC, INT backgroundMode);
177ULONG TranslateCOLORREF(PDC pdc, COLORREF crColor);
178int FASTCALL GreSetStretchBltMode(HDC hdc, int iStretchMode);
187
192VOID NTAPI DC_vCleanup(PVOID ObjectBody);
194
197VOID FASTCALL DC_vCopyState(PDC pdcSrc, PDC pdcDst, BOOL To);
199VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT* rcDest, PDC pdcSrc, const RECT* rcSrc);
200
201VOID NTAPI DC_vRestoreDC(IN PDC pdc, INT iSaveLevel);
202
204VOID NTAPI DC_vInitDc(PDC pdc, DCTYPE dctype, PPDEVOBJ ppdev);
205
206HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC);
210
213
214VOID
215NTAPI
217
219PDC
221{
222 PDC pdc;
223
225 if (pdc)
226 {
227 ASSERT((GDI_HANDLE_GET_TYPE(pdc->BaseObject.hHmgr) == GDILoObjType_LO_DC_TYPE) ||
228 (GDI_HANDLE_GET_TYPE(pdc->BaseObject.hHmgr) == GDILoObjType_LO_ALTDC_TYPE));
229 ASSERT(pdc->dclevel.plfnt != NULL);
230 ASSERT(GDI_HANDLE_GET_TYPE(((POBJ)pdc->dclevel.plfnt)->hHmgr) == GDILoObjType_LO_FONT_TYPE);
231 }
232
233 return pdc;
234}
235
237VOID
239{
240 ASSERT(pdc->dclevel.plfnt != NULL);
241 ASSERT(GDI_HANDLE_GET_TYPE(((POBJ)pdc->dclevel.plfnt)->hHmgr) == GDILoObjType_LO_FONT_TYPE);
242
243 GDIOBJ_vUnlockObject(&pdc->BaseObject);
244}
245
247VOID
249{
250 PSURFACE psurfOld = pdc->dclevel.pSurface;
251 if (psurfOld)
252 {
253 psurfOld->hdc = NULL;
255 }
256 if (psurfNew)
258 pdc->dclevel.pSurface = psurfNew;
259}
260
262VOID
264{
265 PBRUSH pbrFillOld = pdc->dclevel.pbrFill;
266 if (pbrFillOld)
267 BRUSH_ShareUnlockBrush(pbrFillOld);
268 if (pbrFill)
270 pdc->dclevel.pbrFill = pbrFill;
271}
272
274VOID
276{
277 PBRUSH pbrLineOld = pdc->dclevel.pbrLine;
278 if (pbrLineOld)
279 BRUSH_ShareUnlockBrush(pbrLineOld);
280 if (pbrLine)
282 pdc->dclevel.pbrLine = pbrLine;
283}
284
286VOID
288{
289 PPALETTE ppalOld = pdc->dclevel.ppal;
290 if (ppalOld)
292 if (ppal)
294 pdc->dclevel.ppal = ppal;
295}
296
299
300#define ASSERT_DC_PREPARED(pdc) NT_ASSERT((pdc)->fs & DC_PREPARED)
301
302#endif /* not __WIN32K_DC_H */
static HDC hDC
Definition: 3dtext.c:33
#define CODE_SEG(...)
LONG NTSTATUS
Definition: precomp.h:26
struct _DCLEVEL DCLEVEL
FORCEINLINE VOID DC_vSelectSurface(PDC pdc, PSURFACE psurfNew)
Definition: dc.h:248
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
BOOL FASTCALL IntSetDefaultRegion(PDC)
Definition: dcutil.c:350
int FASTCALL GreGetMapMode(HDC)
Definition: dcutil.c:65
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
VOID NTAPI DC_vCleanup(PVOID ObjectBody)
Definition: dclife.c:357
enum _DCFLAGS DCFLAGS
_Notnull_ PBRUSH pbrDefaultBrush
Definition: dclife.c:18
FORCEINLINE VOID DC_vSelectPalette(PDC pdc, PPALETTE ppal)
Definition: dc.h:287
VOID FASTCALL DC_vUpdateViewportExt(PDC pdc)
HFONT NTAPI DC_hSelectFont(_In_ PDC pdc, _In_ HFONT hlfntNew)
Definition: dcobjs.c:550
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
VOID FASTCALL IntvGetDeviceCaps(PPDEVOBJ, PDEVCAPS)
struct _DCLEVEL * PDCLEVEL
VOID FASTCALL DC_vUpdateTextBrush(PDC pdc)
Definition: dcobjs.c:108
VOID FASTCALL IntUpdateBoundsRect(PDC, PRECTL)
Definition: dcutil.c:694
BOOL FASTCALL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest)
VOID NTAPI DC_vFreeDcAttr(PDC pdc)
Definition: dcattr.c:59
COLORREF FASTCALL IntGdiSetBkColor(_In_ HDC hDC, _In_ COLORREF Color)
BOOL FASTCALL IntGdiDeleteDC(HDC, BOOL)
Definition: dclife.c:892
BOOL NTAPI GreSetDCOwner(HDC hdc, ULONG ulOwner)
Definition: dclife.c:455
COLORREF FASTCALL IntGdiSetTextColor(HDC hDC, COLORREF color)
Definition: dcutil.c:172
_Notnull_ PSURFACE psurfDefaultBitmap
Definition: dclife.c:17
VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc)
Definition: dcobjs.c:126
PPDEVOBJ FASTCALL IntEnumHDev(VOID)
Definition: device.c:38
COLORREF FASTCALL IntSetDCPenColor(HDC, COLORREF)
Definition: dcutil.c:259
COLORREF FASTCALL GreGetBkColor(HDC)
Definition: dcutil.c:50
HPALETTE NTAPI GdiSelectPalette(_In_ HDC hDC, _In_ HPALETTE hpal, _In_ BOOL ForceBackground)
_DCTYPE
Definition: dc.h:40
@ DCTYPE_DIRECT
Definition: dc.h:41
@ DCTYPE_MEMORY
Definition: dc.h:42
@ DCTYPE_INFO
Definition: dc.h:43
VOID FASTCALL DC_vCopyState(PDC pdcSrc, PDC pdcDst, BOOL To)
Definition: dcstate.c:16
int FASTCALL GreSetStretchBltMode(HDC hdc, int iStretchMode)
Definition: dcutil.c:283
UINT FASTCALL IntGdiSetTextAlign(HDC hDC, UINT Mode)
Definition: dcutil.c:145
VOID NTAPI DC_vSetBrushOrigin(PDC pdc, LONG x, LONG y)
Definition: dcobjs.c:142
PDC NTAPI DC_AllocDcWithHandle(GDILOOBJTYPE eDcObjType)
Definition: dclife.c:69
PDC defaultDCstate
Definition: device.c:14
VOID FASTCALL DCU_SetDcUndeletable(HDC)
Definition: dcutil.c:322
INT FASTCALL IntGdiSetBkMode(HDC hDC, INT backgroundMode)
Definition: dcutil.c:124
int FASTCALL GreGetBkMode(HDC)
Definition: dcutil.c:35
HDC APIENTRY GreCreateCompatibleDC(HDC hdc, BOOL bAltDc)
Definition: dclife.c:817
HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC)
Definition: dclife.c:1063
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16
COLORREF FASTCALL GreGetTextColor(HDC)
Definition: dcutil.c:80
enum _DCTYPE DCTYPE
COLORREF FASTCALL IntSetDCBrushColor(HDC, COLORREF)
Definition: dcutil.c:206
BOOL FASTCALL GreSetBrushOrg(HDC, INT, INT, LPPOINT)
Definition: dcutil.c:231
BOOL FASTCALL IntGdiCleanDC(HDC hDC)
Definition: dcstate.c:73
VOID NTAPI DC_vRestoreDC(IN PDC pdc, INT iSaveLevel)
Definition: dcstate.c:138
FORCEINLINE VOID DC_vSelectLineBrush(PDC pdc, PBRUSH pbrLine)
Definition: dc.h:275
_DCFLAGS
Definition: dc.h:18
@ DC_ACCUM_APP
Definition: dc.h:25
@ DC_IN_CLONEPDEV
Definition: dc.h:31
@ DC_PERMANANT
Definition: dc.h:22
@ DC_EPSPRINTINGESCAPE
Definition: dc.h:28
@ DC_FULLSCREEN
Definition: dc.h:30
@ DC_DIRTY_RAO
Definition: dc.h:23
@ DC_DISPLAY
Definition: dc.h:19
@ DC_SYNCHRONIZEACCESS
Definition: dc.h:27
@ DC_DIRECT
Definition: dc.h:20
@ DC_CANCELED
Definition: dc.h:21
@ DC_RESET
Definition: dc.h:26
@ DC_REDIRECTION
Definition: dc.h:32
@ DC_SHAREACCESS
Definition: dc.h:33
@ DC_TEMPINFODC
Definition: dc.h:29
@ DC_ACCUM_WMGR
Definition: dc.h:24
BOOL NTAPI DC_bAllocDcAttr(PDC pdc)
Definition: dcattr.c:31
ULONG TranslateCOLORREF(PDC pdc, COLORREF crColor)
Definition: dcutil.c:869
struct _DC DC
VOID NTAPI DC_vInitDc(PDC pdc, DCTYPE dctype, PPDEVOBJ ppdev)
Definition: dclife.c:129
int FASTCALL GreGetGraphicsMode(HDC)
Definition: dcutil.c:306
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
_FONT_STATE
Definition: dc.h:8
@ DC_DIRTYFONT_XFORM
Definition: dc.h:9
@ DC_UFI_MAPPING
Definition: dc.h:11
@ DC_DIRTYFONT_LFONT
Definition: dc.h:10
FORCEINLINE VOID DC_vSelectFillBrush(PDC pdc, PBRUSH pbrFill)
Definition: dc.h:263
NTSTATUS NTAPI InitDcImpl(VOID)
Definition: dclife.c:53
#define NULL
Definition: types.h:112
#define APIENTRY
Definition: api.h:79
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define BRUSH_ShareUnlockBrush(pBrush)
Definition: brush.h:118
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
@ GDILoObjType_LO_FONT_TYPE
Definition: gdi_private.h:37
@ GDILoObjType_LO_DC_TYPE
Definition: gdi_private.h:34
@ GDILoObjType_LO_ALTDC_TYPE
Definition: gdi_private.h:43
enum GDILoObjType GDILOOBJTYPE
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint color
Definition: glext.h:6243
_In_ ULONG Mode
Definition: hubbusif.h:303
#define ASSERT(a)
Definition: mode.c:44
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
unsigned int UINT
Definition: ndis.h:50
#define _Notnull_
Definition: no_sal2.h:54
#define _In_
Definition: no_sal2.h:158
#define FASTCALL
Definition: nt_native.h:50
unsigned long FLONG
Definition: ntbasedef.h:374
@ GDIObjType_DC_TYPE
Definition: ntgdityp.h:121
long LONG
Definition: pedump.c:60
struct DC * PDC
Definition: polytest.cpp:41
Definition: matrix.h:44
Definition: types.h:101
Definition: dc.h:50
FLONG flBrush
Definition: dc.h:75
PREGION prgnMeta
Definition: dc.h:66
POINTL ptlBrushOrigin
Definition: dc.h:58
UNIVERSAL_FONT_ID ufi
Definition: dc.h:69
FLOATOBJ efPr22
Definition: dc.h:86
PSURFACE pSurface
Definition: dc.h:87
FLOATOBJ efPr11
Definition: dc.h:85
FLONG flPath
Definition: dc.h:63
PBRUSH pbrFill
Definition: dc.h:59
_Notnull_ struct _LFONT * plfnt
Definition: dc.h:61
FLOATOBJ efM11_TWIPS
Definition: dc.h:83
FLOATOBJ efDyPtoD
Definition: dc.h:82
UNIVERSAL_FONT_ID * pUFI
Definition: dc.h:71
HGDIOBJ hPath
Definition: dc.h:62
FLOATOBJ efM22PtoD
Definition: dc.h:80
HPALETTE hpal
Definition: dc.h:51
MATRIX mxWorldToPage
Definition: dc.h:78
BOOL ufiSet
Definition: dc.h:73
LONG lIcmMode
Definition: dc.h:54
ULONG uNumUFIs
Definition: dc.h:72
UNIVERSAL_FONT_ID ufiLoc[4]
Definition: dc.h:70
FLOATOBJ efM22_TWIPS
Definition: dc.h:84
LONG lSaveDepth
Definition: dc.h:55
HGDIOBJ hdcSave
Definition: dc.h:57
struct _PALETTE * ppal
Definition: dc.h:52
FLONG flFontState
Definition: dc.h:68
MATRIX mxWorldToDevice
Definition: dc.h:76
PREGION prgnClip
Definition: dc.h:65
LINEATTRS laPath
Definition: dc.h:64
FLONG fl
Definition: dc.h:74
DWORD unk1_00000000
Definition: dc.h:56
PBRUSH pbrLine
Definition: dc.h:60
FLOATOBJ efM11PtoD
Definition: dc.h:79
COLORADJUSTMENT ca
Definition: dc.h:67
FLOATOBJ efDxPtoD
Definition: dc.h:81
MATRIX mxDeviceToWorld
Definition: dc.h:77
PVOID pColorSpace
Definition: dc.h:53
SIZE sizl
Definition: dc.h:88
Definition: dc.h:96
FLONG flGraphicsCaps
Definition: dc.h:106
_Notnull_ PDC_ATTR pdcattr
Definition: dc.h:108
DC_ATTR dcattr
Definition: dc.h:110
XCLIPOBJ co
Definition: dc.h:130
RECTL erclBounds
Definition: dc.h:116
PVOID pSurfInfo
Definition: dc.h:135
RECTL erclWindow
Definition: dc.h:115
DCLEVEL dclevel
Definition: dc.h:109
RECTL erclClip
Definition: dc.h:113
EBRUSHOBJ eboText
Definition: dc.h:124
HDC hdcPrev
Definition: dc.h:112
DHPDEV dhpdev
Definition: dc.h:101
_Notnull_ PREGION prgnVis
Definition: dc.h:119
PREGION prgnAPI
Definition: dc.h:118
LONG lEscapement
Definition: dc.h:128
PVOID pClrxFormLnk
Definition: dc.h:132
DCTYPE dctype
Definition: dc.h:102
POINTL ptlDCOrig
Definition: dc.h:114
EBRUSHOBJ eboBackground
Definition: dc.h:125
PREGION prgnRao
Definition: dc.h:120
FLONG flSimulationFlags
Definition: dc.h:127
BASEOBJECT BaseObject
Definition: dc.h:99
PPDEVOBJ ppdev
Definition: dc.h:104
POINTL ptlFillOrigin
Definition: dc.h:121
EBRUSHOBJ eboLine
Definition: dc.h:123
FLONG flGraphicsCaps2
Definition: dc.h:107
PVOID prfnt
Definition: dc.h:129
EBRUSHOBJ eboFill
Definition: dc.h:122
HFONT hlfntCur
Definition: dc.h:126
PVOID pPFFList
Definition: dc.h:131
POINTL ptlDoBanding
Definition: dc.h:136
HDC hdcNext
Definition: dc.h:111
RECTL erclBoundsApp
Definition: dc.h:117
INT fs
Definition: dc.h:103
ULONG ulCopyCount
Definition: dc.h:134
INT ipfdDevMax
Definition: dc.h:133
PVOID hsem
Definition: dc.h:105
Definition: text.h:60
Definition: region.h:8
HDC hdc
Definition: surface.h:26
#define NTAPI
Definition: typedefs.h:36
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define FORCEINLINE
Definition: wdftypes.h:67
#define SURFACE_ShareUnlockSurface(pBMObj)
Definition: surface.h:102
PGDIOBJ NTAPI GDIOBJ_LockObject(HGDIOBJ hobj, UCHAR objt)
Definition: gdiobj.c:826
VOID NTAPI GDIOBJ_vUnlockObject(POBJ pobj)
Definition: gdiobj.c:880
VOID NTAPI GDIOBJ_vReferenceObjectByPointer(POBJ pobj)
Definition: gdiobj.c:734
#define PALETTE_ShareUnlockPalette(ppal)
Definition: palette.h:59
typedef DHPDEV(APIENTRY FN_DrvEnablePDEV)(_In_ DEVMODEW *pdm
FLOAT FLOATOBJ
Definition: winddi.h:677
DWORD COLORREF
Definition: windef.h:300
#define const
Definition: zconf.h:233