[CMAKE]
[reactos.git] / subsystems / win32 / win32k / include / dc.h
1 #ifndef __WIN32K_DC_H
2 #define __WIN32K_DC_H
3
4 typedef struct _DC *PDC;
5
6 #include "engobjects.h"
7 #include "brush.h"
8 #include "bitmaps.h"
9 #include "pdevobj.h"
10 #include "palette.h"
11 #include "region.h"
12
13 /* Constants ******************************************************************/
14
15 /* Get/SetBounds/Rect support. */
16 #define DCB_WINDOWMGR 0x8000 /* Queries the Windows bounding rectangle instead of the application's */
17
18 /* flFontState */
19 #define DC_DIRTYFONT_XFORM 1
20 #define DC_DIRTYFONT_LFONT 2
21 #define DC_UFI_MAPPING 4
22
23 /* fl */
24 #define DC_FL_PAL_BACK 1
25
26 #define DC_DISPLAY 1
27 #define DC_DIRECT 2
28 #define DC_CANCELED 4
29 #define DC_PERMANANT 0x08
30 #define DC_DIRTY_RAO 0x10
31 #define DC_ACCUM_WMGR 0x20
32 #define DC_ACCUM_APP 0x40
33 #define DC_RESET 0x80
34 #define DC_SYNCHRONIZEACCESS 0x100
35 #define DC_EPSPRINTINGESCAPE 0x200
36 #define DC_TEMPINFODC 0x400
37 #define DC_FULLSCREEN 0x800
38 #define DC_IN_CLONEPDEV 0x1000
39 #define DC_REDIRECTION 0x2000
40 #define DC_SHAREACCESS 0x4000
41
42 typedef enum
43 {
44 DCTYPE_DIRECT = 0,
45 DCTYPE_MEMORY = 1,
46 DCTYPE_INFO = 2,
47 } DCTYPE;
48
49
50 /* Type definitions ***********************************************************/
51
52 typedef struct _ROS_DC_INFO
53 {
54 HRGN hClipRgn; /* Clip region (may be 0) */
55 HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
56
57 CLIPOBJ *CombinedClip;
58
59 UNICODE_STRING DriverName;
60
61 } ROS_DC_INFO;
62
63 typedef struct _DCLEVEL
64 {
65 HPALETTE hpal;
66 struct _PALETTE * ppal;
67 PVOID pColorSpace; /* COLORSPACE* */
68 LONG lIcmMode;
69 LONG lSaveDepth;
70 DWORD unk1_00000000;
71 HGDIOBJ hdcSave;
72 POINTL ptlBrushOrigin;
73 PBRUSH pbrFill;
74 PBRUSH pbrLine;
75 PVOID plfnt; /* LFONTOBJ* (TEXTOBJ*) */
76 HGDIOBJ hPath; /* HPATH */
77 FLONG flPath;
78 LINEATTRS laPath; /* 0x20 bytes */
79 PVOID prgnClip; /* PROSRGNDATA */
80 PVOID prgnMeta;
81 COLORADJUSTMENT ca;
82 FLONG flFontState;
83 UNIVERSAL_FONT_ID ufi;
84 UNIVERSAL_FONT_ID ufiLoc[4]; /* Local List. */
85 UNIVERSAL_FONT_ID *pUFI;
86 ULONG uNumUFIs;
87 BOOL ufiSet;
88 FLONG fl;
89 FLONG flBrush;
90 MATRIX mxWorldToDevice;
91 MATRIX mxDeviceToWorld;
92 MATRIX mxWorldToPage;
93 FLOATOBJ efM11PtoD;
94 FLOATOBJ efM22PtoD;
95 FLOATOBJ efDxPtoD;
96 FLOATOBJ efDyPtoD;
97 FLOATOBJ efM11_TWIPS;
98 FLOATOBJ efM22_TWIPS;
99 FLOATOBJ efPr11;
100 FLOATOBJ efPr22;
101 PSURFACE pSurface;
102 SIZE sizl;
103 } DCLEVEL, *PDCLEVEL;
104
105 /* The DC object structure */
106 typedef struct _DC
107 {
108 /* Header for all gdi objects in the handle table.
109 Do not (re)move this. */
110 BASEOBJECT BaseObject;
111
112 DHPDEV dhpdev; /* <- PDEVOBJ.hPDev DHPDEV for device. */
113 INT dctype;
114 INT fs;
115 PPDEVOBJ ppdev;
116 PVOID hsem; /* PERESOURCE aka HSEMAPHORE */
117 FLONG flGraphicsCaps;
118 FLONG flGraphicsCaps2;
119 PDC_ATTR pdcattr;
120 DCLEVEL dclevel;
121 DC_ATTR dcattr;
122 HDC hdcNext;
123 HDC hdcPrev;
124 RECTL erclClip;
125 POINTL ptlDCOrig;
126 RECTL erclWindow;
127 RECTL erclBounds;
128 RECTL erclBoundsApp;
129 PROSRGNDATA prgnAPI; /* PROSRGNDATA */
130 PROSRGNDATA prgnVis; /* Visible region (must never be 0) */
131 PROSRGNDATA prgnRao;
132 POINTL ptlFillOrigin;
133 EBRUSHOBJ eboFill;
134 EBRUSHOBJ eboLine;
135 EBRUSHOBJ eboText;
136 EBRUSHOBJ eboBackground;
137 HFONT hlfntCur;
138 FLONG flSimulationFlags;
139 LONG lEscapement;
140 PVOID prfnt; /* RFONT* */
141 XCLIPOBJ co; /* CLIPOBJ */
142 PVOID pPFFList; /* PPFF* */
143 PVOID pClrxFormLnk;
144 INT ipfdDevMax;
145 ULONG ulCopyCount;
146 PVOID pSurfInfo;
147 POINTL ptlDoBanding;
148
149 /* Reactos specific members */
150 ROS_DC_INFO rosdc;
151 } DC;
152
153 /* Internal functions *********************************************************/
154
155 #define DC_LockDc(hDC) \
156 ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
157 #define DC_UnlockDc(pDC) \
158 GDIOBJ_UnlockObjByPtr ((POBJ)pDC)
159
160 extern PDC defaultDCstate;
161
162 INIT_FUNCTION NTSTATUS NTAPI InitDcImpl();
163 PPDEVOBJ FASTCALL IntEnumHDev(VOID);
164 PDC NTAPI DC_AllocDcWithHandle();
165 VOID FASTCALL DC_InitDC(HDC DCToInit);
166 VOID FASTCALL DC_AllocateDcAttr(HDC);
167 VOID FASTCALL DC_FreeDcAttr(HDC);
168 BOOL INTERNAL_CALL DC_Cleanup(PVOID ObjectBody);
169 BOOL FASTCALL DC_SetOwnership(HDC hDC, PEPROCESS Owner);
170 VOID FASTCALL DC_LockDisplay(HDC);
171 VOID FASTCALL DC_UnlockDisplay(HDC);
172 BOOL FASTCALL IntGdiDeleteDC(HDC, BOOL);
173
174 VOID FASTCALL DC_UpdateXforms(PDC dc);
175 BOOL FASTCALL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest);
176 VOID FASTCALL DC_vUpdateViewportExt(PDC pdc);
177 VOID FASTCALL DC_vCopyState(PDC pdcSrc, PDC pdcDst, BOOL to);
178 VOID FASTCALL DC_vUpdateFillBrush(PDC pdc);
179 VOID FASTCALL DC_vUpdateLineBrush(PDC pdc);
180 VOID FASTCALL DC_vUpdateTextBrush(PDC pdc);
181 VOID FASTCALL DC_vUpdateBackgroundBrush(PDC pdc);
182 VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2);
183 VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdc1, RECT rc1, PDC pdc2, RECT rc2);
184
185 VOID NTAPI DC_vRestoreDC(IN PDC pdc, INT iSaveLevel);
186
187 BOOL FASTCALL DCU_SyncDcAttrtoUser(PDC);
188 BOOL FASTCALL DCU_SynchDcAttrtoUser(HDC);
189 VOID FASTCALL DCU_SetDcUndeletable(HDC);
190 VOID NTAPI DC_vFreeDcAttr(PDC pdc);
191 VOID NTAPI DC_vInitDc(PDC pdc, DCTYPE dctype, PPDEVOBJ ppdev);
192
193 COLORREF FASTCALL IntGdiSetBkColor (HDC hDC, COLORREF Color);
194 INT FASTCALL IntGdiSetBkMode(HDC hDC, INT backgroundMode);
195 COLORREF APIENTRY IntGdiGetBkColor(HDC hDC);
196 INT APIENTRY IntGdiGetBkMode(HDC hDC);
197 COLORREF FASTCALL IntGdiSetTextColor(HDC hDC, COLORREF color);
198 UINT FASTCALL IntGdiSetTextAlign(HDC hDC, UINT Mode);
199 UINT APIENTRY IntGdiGetTextAlign(HDC hDC);
200 COLORREF APIENTRY IntGdiGetTextColor(HDC hDC);
201 INT APIENTRY IntGdiSetStretchBltMode(HDC hDC, INT stretchBltMode);
202 VOID FASTCALL IntGdiReferencePdev(PPDEVOBJ pPDev);
203 VOID FASTCALL IntGdiUnreferencePdev(PPDEVOBJ pPDev, DWORD CleanUpType);
204 HDC FASTCALL IntGdiCreateDisplayDC(HDEV hDev, ULONG DcType, BOOL EmptyDC);
205 BOOL FASTCALL IntGdiCleanDC(HDC hDC);
206 VOID FASTCALL IntvGetDeviceCaps(PPDEVOBJ, PDEVCAPS);
207 BOOL FASTCALL MakeInfoDC(PDC,BOOL);
208 BOOL FASTCALL IntSetDefaultRegion(PDC);
209
210 VOID
211 FORCEINLINE
212 DC_vSelectSurface(PDC pdc, PSURFACE psurfNew)
213 {
214 PSURFACE psurfOld = pdc->dclevel.pSurface;
215 if (psurfOld)
216 SURFACE_ShareUnlockSurface(psurfOld);
217 if (psurfNew)
218 GDIOBJ_IncrementShareCount((POBJ)psurfNew);
219 pdc->dclevel.pSurface = psurfNew;
220 }
221
222 VOID
223 FORCEINLINE
224 DC_vSelectFillBrush(PDC pdc, PBRUSH pbrFill)
225 {
226 PBRUSH pbrFillOld = pdc->dclevel.pbrFill;
227 if (pbrFillOld)
228 BRUSH_ShareUnlockBrush(pbrFillOld);
229 if (pbrFill)
230 GDIOBJ_IncrementShareCount((POBJ)pbrFill);
231 pdc->dclevel.pbrFill = pbrFill;
232 }
233
234 VOID
235 FORCEINLINE
236 DC_vSelectLineBrush(PDC pdc, PBRUSH pbrLine)
237 {
238 PBRUSH pbrLineOld = pdc->dclevel.pbrLine;
239 if (pbrLineOld)
240 BRUSH_ShareUnlockBrush(pbrLineOld);
241 if (pbrLine)
242 GDIOBJ_IncrementShareCount((POBJ)pbrLine);
243 pdc->dclevel.pbrLine = pbrLine;
244 }
245
246 VOID
247 FORCEINLINE
248 DC_vSelectPalette(PDC pdc, PPALETTE ppal)
249 {
250 PPALETTE ppalOld = pdc->dclevel.ppal;
251 if (ppalOld)
252 PALETTE_ShareUnlockPalette(ppalOld);
253 if (ppal)
254 GDIOBJ_IncrementShareCount((POBJ)ppal);
255 pdc->dclevel.ppal = ppal;
256 }
257
258 extern PBRUSH pbrDefaultBrush ;
259
260 #endif /* not __WIN32K_DC_H */