gdi32: Remove OpenGL functions that don't use an HDC from the driver entry points.
[wine] / include / wine / gdi_driver.h
1 /*
2  * Definitions for Wine GDI drivers
3  *
4  * Copyright 2011 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #ifndef __WINE_WINE_GDI_DRIVER_H
22 #define __WINE_WINE_GDI_DRIVER_H
23
24 struct gdi_dc_funcs;
25
26 typedef struct gdi_physdev
27 {
28     const struct gdi_dc_funcs *funcs;
29     struct gdi_physdev        *next;
30     HDC                        hdc;
31 } *PHYSDEV;
32
33 struct bitblt_coords
34 {
35     int  log_x;     /* original position and size, in logical coords */
36     int  log_y;
37     int  log_width;
38     int  log_height;
39     int  x;         /* mapped position and size, in device coords */
40     int  y;
41     int  width;
42     int  height;
43     RECT visrect;   /* rectangle clipped to the visible part, in device coords */
44     DWORD layout;   /* DC layout */
45 };
46
47 struct gdi_image_bits
48 {
49     void   *ptr;       /* pointer to the bits */
50     BOOL    is_copy;   /* whether this is a copy of the bits that can be modified */
51     void  (*free)(struct gdi_image_bits *);  /* callback for freeing the bits */
52     void   *param;     /* extra parameter for callback private use */
53 };
54
55 struct brush_pattern
56 {
57     BITMAPINFO           *info;     /* DIB info */
58     struct gdi_image_bits bits;     /* DIB bits */
59     UINT                  usage;    /* color usage for DIB info */
60 };
61
62 struct gdi_dc_funcs
63 {
64     INT      (*pAbortDoc)(PHYSDEV);
65     BOOL     (*pAbortPath)(PHYSDEV);
66     BOOL     (*pAlphaBlend)(PHYSDEV,struct bitblt_coords*,PHYSDEV,struct bitblt_coords*,BLENDFUNCTION);
67     BOOL     (*pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
68     BOOL     (*pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
69     BOOL     (*pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
70     BOOL     (*pBeginPath)(PHYSDEV);
71     DWORD    (*pBlendImage)(PHYSDEV,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,BLENDFUNCTION);
72     INT      (*pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
73     BOOL     (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
74     BOOL     (*pCloseFigure)(PHYSDEV);
75     BOOL     (*pCreateCompatibleDC)(PHYSDEV,PHYSDEV*);
76     BOOL     (*pCreateDC)(PHYSDEV*,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*);
77     BOOL     (*pDeleteDC)(PHYSDEV);
78     BOOL     (*pDeleteObject)(PHYSDEV,HGDIOBJ);
79     INT      (*pDescribePixelFormat)(PHYSDEV,INT,UINT,PIXELFORMATDESCRIPTOR *);
80     DWORD    (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
81     BOOL     (*pEllipse)(PHYSDEV,INT,INT,INT,INT);
82     INT      (*pEndDoc)(PHYSDEV);
83     INT      (*pEndPage)(PHYSDEV);
84     BOOL     (*pEndPath)(PHYSDEV);
85     BOOL     (*pEnumFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
86     INT      (*pEnumICMProfiles)(PHYSDEV,ICMENUMPROCW,LPARAM);
87     INT      (*pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
88     INT      (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
89     INT      (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
90     BOOL     (*pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
91     INT      (*pExtSelectClipRgn)(PHYSDEV,HRGN,INT);
92     BOOL     (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
93     BOOL     (*pFillPath)(PHYSDEV);
94     BOOL     (*pFillRgn)(PHYSDEV,HRGN,HBRUSH);
95     BOOL     (*pFlattenPath)(PHYSDEV);
96     BOOL     (*pFontIsLinked)(PHYSDEV);
97     BOOL     (*pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
98     BOOL     (*pGdiComment)(PHYSDEV,UINT,CONST BYTE*);
99     BOOL     (*pGdiRealizationInfo)(PHYSDEV,void*);
100     UINT     (*pGetBoundsRect)(PHYSDEV,RECT*,UINT);
101     BOOL     (*pGetCharABCWidths)(PHYSDEV,UINT,UINT,LPABC);
102     BOOL     (*pGetCharABCWidthsI)(PHYSDEV,UINT,UINT,WORD*,LPABC);
103     BOOL     (*pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
104     INT      (*pGetDeviceCaps)(PHYSDEV,INT);
105     BOOL     (*pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
106     DWORD    (*pGetFontData)(PHYSDEV,DWORD,DWORD,LPVOID,DWORD);
107     DWORD    (*pGetFontUnicodeRanges)(PHYSDEV,LPGLYPHSET);
108     DWORD    (*pGetGlyphIndices)(PHYSDEV,LPCWSTR,INT,LPWORD,DWORD);
109     DWORD    (*pGetGlyphOutline)(PHYSDEV,UINT,UINT,LPGLYPHMETRICS,DWORD,LPVOID,const MAT2*);
110     BOOL     (*pGetICMProfile)(PHYSDEV,LPDWORD,LPWSTR);
111     DWORD    (*pGetImage)(PHYSDEV,BITMAPINFO*,struct gdi_image_bits*,struct bitblt_coords*);
112     DWORD    (*pGetKerningPairs)(PHYSDEV,DWORD,LPKERNINGPAIR);
113     COLORREF (*pGetNearestColor)(PHYSDEV,COLORREF);
114     UINT     (*pGetOutlineTextMetrics)(PHYSDEV,UINT,LPOUTLINETEXTMETRICW);
115     COLORREF (*pGetPixel)(PHYSDEV,INT,INT);
116     INT      (*pGetPixelFormat)(PHYSDEV);
117     UINT     (*pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY);
118     UINT     (*pGetTextCharsetInfo)(PHYSDEV,LPFONTSIGNATURE,DWORD);
119     BOOL     (*pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,INT,LPINT,LPINT,LPSIZE);
120     BOOL     (*pGetTextExtentExPointI)(PHYSDEV,const WORD*,INT,INT,LPINT,LPINT,LPSIZE);
121     INT      (*pGetTextFace)(PHYSDEV,INT,LPWSTR);
122     BOOL     (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
123     BOOL     (*pGradientFill)(PHYSDEV,TRIVERTEX*,ULONG,void*,ULONG,ULONG);
124     INT      (*pIntersectClipRect)(PHYSDEV,INT,INT,INT,INT);
125     BOOL     (*pInvertRgn)(PHYSDEV,HRGN);
126     BOOL     (*pLineTo)(PHYSDEV,INT,INT);
127     BOOL     (*pModifyWorldTransform)(PHYSDEV,const XFORM*,DWORD);
128     BOOL     (*pMoveTo)(PHYSDEV,INT,INT);
129     INT      (*pOffsetClipRgn)(PHYSDEV,INT,INT);
130     BOOL     (*pOffsetViewportOrgEx)(PHYSDEV,INT,INT,POINT*);
131     BOOL     (*pOffsetWindowOrgEx)(PHYSDEV,INT,INT,POINT*);
132     BOOL     (*pPaintRgn)(PHYSDEV,HRGN);
133     BOOL     (*pPatBlt)(PHYSDEV,struct bitblt_coords*,DWORD);
134     BOOL     (*pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
135     BOOL     (*pPolyBezier)(PHYSDEV,const POINT*,DWORD);
136     BOOL     (*pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
137     BOOL     (*pPolyDraw)(PHYSDEV,const POINT*,const BYTE *,DWORD);
138     BOOL     (*pPolyPolygon)(PHYSDEV,const POINT*,const INT*,UINT);
139     BOOL     (*pPolyPolyline)(PHYSDEV,const POINT*,const DWORD*,DWORD);
140     BOOL     (*pPolygon)(PHYSDEV,const POINT*,INT);
141     BOOL     (*pPolyline)(PHYSDEV,const POINT*,INT);
142     BOOL     (*pPolylineTo)(PHYSDEV,const POINT*,INT);
143     DWORD    (*pPutImage)(PHYSDEV,HRGN,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,DWORD);
144     UINT     (*pRealizeDefaultPalette)(PHYSDEV);
145     UINT     (*pRealizePalette)(PHYSDEV,HPALETTE,BOOL);
146     BOOL     (*pRectangle)(PHYSDEV,INT,INT,INT,INT);
147     HDC      (*pResetDC)(PHYSDEV,const DEVMODEW*);
148     BOOL     (*pRestoreDC)(PHYSDEV,INT);
149     BOOL     (*pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
150     INT      (*pSaveDC)(PHYSDEV);
151     BOOL     (*pScaleViewportExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
152     BOOL     (*pScaleWindowExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
153     HBITMAP  (*pSelectBitmap)(PHYSDEV,HBITMAP);
154     HBRUSH   (*pSelectBrush)(PHYSDEV,HBRUSH,const struct brush_pattern*);
155     BOOL     (*pSelectClipPath)(PHYSDEV,INT);
156     HFONT    (*pSelectFont)(PHYSDEV,HFONT);
157     HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
158     HPEN     (*pSelectPen)(PHYSDEV,HPEN,const struct brush_pattern*);
159     INT      (*pSetArcDirection)(PHYSDEV,INT);
160     COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
161     INT      (*pSetBkMode)(PHYSDEV,INT);
162     UINT     (*pSetBoundsRect)(PHYSDEV,RECT*,UINT);
163     COLORREF (*pSetDCBrushColor)(PHYSDEV, COLORREF);
164     COLORREF (*pSetDCPenColor)(PHYSDEV, COLORREF);
165     INT      (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,BITMAPINFO*,UINT);
166     VOID     (*pSetDeviceClipping)(PHYSDEV,HRGN);
167     BOOL     (*pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
168     DWORD    (*pSetLayout)(PHYSDEV,DWORD);
169     INT      (*pSetMapMode)(PHYSDEV,INT);
170     DWORD    (*pSetMapperFlags)(PHYSDEV,DWORD);
171     COLORREF (*pSetPixel)(PHYSDEV,INT,INT,COLORREF);
172     BOOL     (*pSetPixelFormat)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
173     INT      (*pSetPolyFillMode)(PHYSDEV,INT);
174     INT      (*pSetROP2)(PHYSDEV,INT);
175     INT      (*pSetRelAbs)(PHYSDEV,INT);
176     INT      (*pSetStretchBltMode)(PHYSDEV,INT);
177     UINT     (*pSetTextAlign)(PHYSDEV,UINT);
178     INT      (*pSetTextCharacterExtra)(PHYSDEV,INT);
179     COLORREF (*pSetTextColor)(PHYSDEV,COLORREF);
180     BOOL     (*pSetTextJustification)(PHYSDEV,INT,INT);
181     BOOL     (*pSetViewportExtEx)(PHYSDEV,INT,INT,SIZE*);
182     BOOL     (*pSetViewportOrgEx)(PHYSDEV,INT,INT,POINT*);
183     BOOL     (*pSetWindowExtEx)(PHYSDEV,INT,INT,SIZE*);
184     BOOL     (*pSetWindowOrgEx)(PHYSDEV,INT,INT,POINT*);
185     BOOL     (*pSetWorldTransform)(PHYSDEV,const XFORM*);
186     INT      (*pStartDoc)(PHYSDEV,const DOCINFOW*);
187     INT      (*pStartPage)(PHYSDEV);
188     BOOL     (*pStretchBlt)(PHYSDEV,struct bitblt_coords*,PHYSDEV,struct bitblt_coords*,DWORD);
189     INT      (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void*,BITMAPINFO*,UINT,DWORD);
190     BOOL     (*pStrokeAndFillPath)(PHYSDEV);
191     BOOL     (*pStrokePath)(PHYSDEV);
192     BOOL     (*pSwapBuffers)(PHYSDEV);
193     BOOL     (*pUnrealizePalette)(HPALETTE);
194     BOOL     (*pWidenPath)(PHYSDEV);
195     HGLRC    (*pwglCreateContext)(PHYSDEV);
196     HGLRC    (*pwglCreateContextAttribsARB)(PHYSDEV,HGLRC,const int*);
197     PROC     (*pwglGetProcAddress)(LPCSTR);
198     BOOL     (*pwglMakeContextCurrentARB)(PHYSDEV,PHYSDEV,HGLRC);
199     BOOL     (*pwglMakeCurrent)(PHYSDEV,HGLRC);
200     BOOL     (*pwglSetPixelFormatWINE)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR*);
201
202     /* priority order for the driver on the stack */
203     UINT       priority;
204 };
205
206 /* increment this when you change the DC function table */
207 #define WINE_GDI_DRIVER_VERSION 32
208
209 #define GDI_PRIORITY_NULL_DRV        0  /* null driver */
210 #define GDI_PRIORITY_FONT_DRV      100  /* any font driver */
211 #define GDI_PRIORITY_GRAPHICS_DRV  200  /* any graphics driver */
212 #define GDI_PRIORITY_DIB_DRV       300  /* the DIB driver */
213 #define GDI_PRIORITY_PATH_DRV      400  /* the path driver */
214
215 static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
216 {
217     while (!((void **)dev->funcs)[offset / sizeof(void *)]) dev = dev->next;
218     return dev;
219 }
220
221 #define GET_NEXT_PHYSDEV(dev,func) \
222     get_physdev_entry_point( (dev)->next, FIELD_OFFSET(struct gdi_dc_funcs,func))
223
224 static inline void push_dc_driver( PHYSDEV *dev, PHYSDEV physdev, const struct gdi_dc_funcs *funcs )
225 {
226     while ((*dev)->funcs->priority > funcs->priority) dev = &(*dev)->next;
227     physdev->funcs = funcs;
228     physdev->next = *dev;
229     physdev->hdc = (*dev)->hdc;
230     *dev = physdev;
231 }
232
233 /* the DC hook support is only exported on Win16, the 32-bit version is a Wine extension */
234
235 #define DCHC_INVALIDVISRGN      0x0001
236 #define DCHC_DELETEDC           0x0002
237 #define DCHF_INVALIDATEVISRGN   0x0001
238 #define DCHF_VALIDATEVISRGN     0x0002
239
240 typedef BOOL (CALLBACK *DCHOOKPROC)(HDC,WORD,DWORD_PTR,LPARAM);
241
242 WINGDIAPI DWORD_PTR WINAPI GetDCHook(HDC,DCHOOKPROC*);
243 WINGDIAPI BOOL      WINAPI SetDCHook(HDC,DCHOOKPROC,DWORD_PTR);
244 WINGDIAPI WORD      WINAPI SetHookFlags(HDC,WORD);
245
246 extern void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set );
247 extern void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect );
248
249 #endif /* __WINE_WINE_GDI_DRIVER_H */