ReAlloc should be able to move memory blocks if necessary. This fixes
[reactos.git] / reactos / subsys / win32k / include / dc.h
1
2 #ifndef __WIN32K_DC_H
3 #define __WIN32K_DC_H
4
5 #include "driver.h"
6
7 typedef enum tagGdiPathState
8 {
9 PATH_Null,
10 PATH_Open,
11 PATH_Closed
12 } GdiPathState;
13
14 typedef struct tagGdiPath
15 {
16 GdiPathState state;
17 POINT *pPoints;
18 BYTE *pFlags;
19 int numEntriesUsed, numEntriesAllocated;
20 BOOL newStroke;
21 } GdiPath;
22
23 typedef struct _WIN_DC_INFO
24 {
25 int flags;
26 HRGN hClipRgn; /* Clip region (may be 0) */
27 HRGN hVisRgn; /* Visible region (must never be 0) */
28 HRGN hGCClipRgn; /* GC clip region (ClipRgn AND VisRgn) */
29 HPEN hPen;
30 HBRUSH hBrush;
31 HFONT hFont;
32 HBITMAP hBitmap;
33 HBITMAP hFirstBitmap; /* Bitmap selected at creation of the DC */
34
35 /* #if 0 */
36 HANDLE hDevice;
37 HPALETTE hPalette;
38
39 GdiPath path;
40 /* #endif */
41
42 WORD ROPmode;
43 WORD polyFillMode;
44 WORD stretchBltMode;
45 WORD relAbsMode;
46 WORD backgroundMode;
47 COLORREF backgroundColor;
48 COLORREF textColor;
49
50 short brushOrgX;
51 short brushOrgY;
52
53 WORD textAlign; /* Text alignment from SetTextAlign() */
54 short charExtra; /* Spacing from SetTextCharacterExtra() */
55 short breakTotalExtra; /* Total extra space for justification */
56 short breakCount; /* Break char. count */
57 short breakExtra; /* breakTotalExtra / breakCount */
58 short breakRem; /* breakTotalExtra % breakCount */
59
60 RECT totalExtent;
61 BYTE bitsPerPixel;
62
63 INT MapMode;
64 INT GraphicsMode; /* Graphics mode */
65 INT DCOrgX; /* DC origin */
66 INT DCOrgY;
67
68 #if 0
69 FARPROC lpfnPrint; /* AbortProc for Printing */
70 #endif
71
72 INT CursPosX; /* Current position */
73 INT CursPosY;
74 INT ArcDirection;
75
76 XFORM xformWorld2Wnd; /* World-to-window transformation */
77 XFORM xformWorld2Vport; /* World-to-viewport transformation */
78 XFORM xformVport2World; /* Inverse of the above transformation */
79 BOOL vport2WorldValid; /* Is xformVport2World valid? */
80 } WIN_DC_INFO;
81
82 /* DC flags */
83 #define DC_MEMORY 0x0001 /* It is a memory DC */
84 #define DC_SAVED 0x0002 /* It is a saved DC */
85 #define DC_DIRTY 0x0004 /* hVisRgn has to be updated */
86 #define DC_THUNKHOOK 0x0008 /* DC hook is in the 16-bit code */
87
88 #define GDI_DC_TYPE (1)
89
90 typedef struct _DC
91 {
92 HDC hSelf;
93 HDC hNext;
94 DHPDEV PDev;
95 HSURF FillPatternSurfaces[HS_DDI_MAX];
96 PGDIINFO GDIInfo;
97 PDEVINFO DevInfo;
98 HDEV GDIDevice;
99
100 DRIVER_FUNCTIONS DriverFunctions;
101 UNICODE_STRING DriverName;
102 HANDLE DeviceDriver;
103
104 INT wndOrgX; /* Window origin */
105 INT wndOrgY;
106 INT wndExtX; /* Window extent */
107 INT wndExtY;
108 INT vportOrgX; /* Viewport origin */
109 INT vportOrgY;
110 INT vportExtX; /* Viewport extent */
111 INT vportExtY;
112
113 CLIPOBJ *CombinedClip;
114
115 XLATEOBJ *XlateBrush;
116 XLATEOBJ *XlatePen;
117
118 INT saveLevel;
119 BOOL IsIC;
120
121 HPALETTE PalIndexed;
122
123 WIN_DC_INFO w;
124 } DC, *PDC;
125
126 typedef struct _GDIPOINTER /* should stay private to ENG */
127 {
128 /* private GDI pointer handling information, required for software emulation */
129 BOOL Enabled;
130 POINTL Pos;
131 SIZEL Size;
132 POINTL HotSpot;
133 XLATEOBJ *XlateObject;
134 HSURF ColorSurface;
135 HSURF MaskSurface;
136 HSURF SaveSurface;
137
138 /* public pointer information */
139 RECTL Exclude; /* required publicly for SPS_ACCEPT_EXCLUDE */
140 PGD_MOVEPOINTER MovePointer;
141 ULONG Status;
142 } GDIPOINTER, *PGDIPOINTER;
143
144 typedef struct
145 {
146 HANDLE Handle;
147 DHPDEV PDev;
148 DEVMODEW DMW;
149 HSURF FillPatterns[HS_DDI_MAX];
150 GDIINFO GDIInfo;
151 DEVINFO DevInfo;
152 DRIVER_FUNCTIONS DriverFunctions;
153 PFILE_OBJECT VideoFileObject;
154 BOOLEAN PreparedDriver;
155 ULONG DisplayNumber;
156
157 GDIPOINTER Pointer;
158
159 /* Stuff to keep track of software cursors; win32k gdi part */
160 UINT SafetyRemoveLevel; /* at what level was the cursor removed?
161 0 for not removed */
162 UINT SafetyRemoveCount;
163 } GDIDEVICE;
164
165 /* Internal functions */
166
167 #define DC_LockDc(hDC) \
168 ((PDC) GDIOBJ_LockObj ((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC))
169 #define DC_UnlockDc(pDC) \
170 GDIOBJ_UnlockObjByPtr (pDC)
171
172 HDC FASTCALL RetrieveDisplayHDC(VOID);
173 HDC FASTCALL DC_AllocDC(PUNICODE_STRING Driver);
174 VOID FASTCALL DC_InitDC(HDC DCToInit);
175 HDC FASTCALL DC_FindOpenDC(PUNICODE_STRING Driver);
176 VOID FASTCALL DC_FreeDC(HDC DCToFree);
177 BOOL INTERNAL_CALL DC_Cleanup(PVOID ObjectBody);
178 HDC FASTCALL DC_GetNextDC (PDC pDC);
179 VOID FASTCALL DC_SetNextDC (PDC pDC, HDC hNextDC);
180 VOID FASTCALL DC_SetOwnership(HDC DC, PEPROCESS Owner);
181
182 VOID FASTCALL DC_UpdateXforms(PDC dc);
183 BOOL FASTCALL DC_InvertXform(const XFORM *xformSrc, XFORM *xformDest);
184
185 #endif