gdi32: Add a CopyBitmap driver entry point.
[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 gdi_dc_funcs
56 {
57     INT      (*pAbortDoc)(PHYSDEV);
58     BOOL     (*pAbortPath)(PHYSDEV);
59     BOOL     (*pAlphaBlend)(PHYSDEV,struct bitblt_coords*,PHYSDEV,struct bitblt_coords*,BLENDFUNCTION);
60     BOOL     (*pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
61     BOOL     (*pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
62     BOOL     (*pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
63     BOOL     (*pBeginPath)(PHYSDEV);
64     DWORD    (*pBlendImage)(PHYSDEV,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,BLENDFUNCTION);
65     INT      (*pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
66     BOOL     (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
67     BOOL     (*pCloseFigure)(PHYSDEV);
68     BOOL     (*pCopyBitmap)(HBITMAP,HBITMAP);
69     BOOL     (*pCreateBitmap)(PHYSDEV,HBITMAP);
70     BOOL     (*pCreateCompatibleDC)(PHYSDEV,PHYSDEV*);
71     BOOL     (*pCreateDC)(PHYSDEV*,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*);
72     HBITMAP  (*pCreateDIBSection)(PHYSDEV,HBITMAP,BITMAPINFO *,UINT);
73     BOOL     (*pDeleteBitmap)(HBITMAP);
74     BOOL     (*pDeleteDC)(PHYSDEV);
75     BOOL     (*pDeleteObject)(PHYSDEV,HGDIOBJ);
76     INT      (*pDescribePixelFormat)(PHYSDEV,INT,UINT,PIXELFORMATDESCRIPTOR *);
77     DWORD    (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
78     BOOL     (*pEllipse)(PHYSDEV,INT,INT,INT,INT);
79     INT      (*pEndDoc)(PHYSDEV);
80     INT      (*pEndPage)(PHYSDEV);
81     BOOL     (*pEndPath)(PHYSDEV);
82     BOOL     (*pEnumFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
83     INT      (*pEnumICMProfiles)(PHYSDEV,ICMENUMPROCW,LPARAM);
84     INT      (*pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
85     INT      (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
86     INT      (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
87     BOOL     (*pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
88     INT      (*pExtSelectClipRgn)(PHYSDEV,HRGN,INT);
89     BOOL     (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
90     BOOL     (*pFillPath)(PHYSDEV);
91     BOOL     (*pFillRgn)(PHYSDEV,HRGN,HBRUSH);
92     BOOL     (*pFlattenPath)(PHYSDEV);
93     BOOL     (*pFontIsLinked)(PHYSDEV);
94     BOOL     (*pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
95     BOOL     (*pGdiComment)(PHYSDEV,UINT,CONST BYTE*);
96     BOOL     (*pGdiRealizationInfo)(PHYSDEV,void*);
97     BOOL     (*pGetCharABCWidths)(PHYSDEV,UINT,UINT,LPABC);
98     BOOL     (*pGetCharABCWidthsI)(PHYSDEV,UINT,UINT,WORD*,LPABC);
99     BOOL     (*pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
100     INT      (*pGetDeviceCaps)(PHYSDEV,INT);
101     BOOL     (*pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
102     DWORD    (*pGetFontData)(PHYSDEV,DWORD,DWORD,LPVOID,DWORD);
103     DWORD    (*pGetFontUnicodeRanges)(PHYSDEV,LPGLYPHSET);
104     DWORD    (*pGetGlyphIndices)(PHYSDEV,LPCWSTR,INT,LPWORD,DWORD);
105     DWORD    (*pGetGlyphOutline)(PHYSDEV,UINT,UINT,LPGLYPHMETRICS,DWORD,LPVOID,const MAT2*);
106     BOOL     (*pGetICMProfile)(PHYSDEV,LPDWORD,LPWSTR);
107     DWORD    (*pGetImage)(PHYSDEV,HBITMAP,BITMAPINFO*,struct gdi_image_bits*,struct bitblt_coords*);
108     DWORD    (*pGetKerningPairs)(PHYSDEV,DWORD,LPKERNINGPAIR);
109     COLORREF (*pGetNearestColor)(PHYSDEV,COLORREF);
110     UINT     (*pGetOutlineTextMetrics)(PHYSDEV,UINT,LPOUTLINETEXTMETRICW);
111     COLORREF (*pGetPixel)(PHYSDEV,INT,INT);
112     INT      (*pGetPixelFormat)(PHYSDEV);
113     UINT     (*pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY);
114     UINT     (*pGetTextCharsetInfo)(PHYSDEV,LPFONTSIGNATURE,DWORD);
115     BOOL     (*pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,INT,LPINT,LPINT,LPSIZE);
116     BOOL     (*pGetTextExtentExPointI)(PHYSDEV,const WORD*,INT,INT,LPINT,LPINT,LPSIZE);
117     INT      (*pGetTextFace)(PHYSDEV,INT,LPWSTR);
118     BOOL     (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
119     BOOL     (*pGradientFill)(PHYSDEV,TRIVERTEX*,ULONG,void*,ULONG,ULONG);
120     INT      (*pIntersectClipRect)(PHYSDEV,INT,INT,INT,INT);
121     BOOL     (*pInvertRgn)(PHYSDEV,HRGN);
122     BOOL     (*pLineTo)(PHYSDEV,INT,INT);
123     BOOL     (*pModifyWorldTransform)(PHYSDEV,const XFORM*,DWORD);
124     BOOL     (*pMoveTo)(PHYSDEV,INT,INT);
125     INT      (*pOffsetClipRgn)(PHYSDEV,INT,INT);
126     BOOL     (*pOffsetViewportOrgEx)(PHYSDEV,INT,INT,POINT*);
127     BOOL     (*pOffsetWindowOrgEx)(PHYSDEV,INT,INT,POINT*);
128     BOOL     (*pPaintRgn)(PHYSDEV,HRGN);
129     BOOL     (*pPatBlt)(PHYSDEV,struct bitblt_coords*,DWORD);
130     BOOL     (*pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
131     BOOL     (*pPolyBezier)(PHYSDEV,const POINT*,DWORD);
132     BOOL     (*pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
133     BOOL     (*pPolyDraw)(PHYSDEV,const POINT*,const BYTE *,DWORD);
134     BOOL     (*pPolyPolygon)(PHYSDEV,const POINT*,const INT*,UINT);
135     BOOL     (*pPolyPolyline)(PHYSDEV,const POINT*,const DWORD*,DWORD);
136     BOOL     (*pPolygon)(PHYSDEV,const POINT*,INT);
137     BOOL     (*pPolyline)(PHYSDEV,const POINT*,INT);
138     BOOL     (*pPolylineTo)(PHYSDEV,const POINT*,INT);
139     DWORD    (*pPutImage)(PHYSDEV,HBITMAP,HRGN,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,DWORD);
140     UINT     (*pRealizeDefaultPalette)(PHYSDEV);
141     UINT     (*pRealizePalette)(PHYSDEV,HPALETTE,BOOL);
142     BOOL     (*pRectangle)(PHYSDEV,INT,INT,INT,INT);
143     HDC      (*pResetDC)(PHYSDEV,const DEVMODEW*);
144     BOOL     (*pRestoreDC)(PHYSDEV,INT);
145     BOOL     (*pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
146     INT      (*pSaveDC)(PHYSDEV);
147     BOOL     (*pScaleViewportExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
148     BOOL     (*pScaleWindowExtEx)(PHYSDEV,INT,INT,INT,INT,SIZE*);
149     HBITMAP  (*pSelectBitmap)(PHYSDEV,HBITMAP);
150     HBRUSH   (*pSelectBrush)(PHYSDEV,HBRUSH,HBITMAP,const BITMAPINFO*,void*,UINT);
151     BOOL     (*pSelectClipPath)(PHYSDEV,INT);
152     HFONT    (*pSelectFont)(PHYSDEV,HFONT);
153     HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
154     HPEN     (*pSelectPen)(PHYSDEV,HPEN);
155     INT      (*pSetArcDirection)(PHYSDEV,INT);
156     COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
157     INT      (*pSetBkMode)(PHYSDEV,INT);
158     COLORREF (*pSetDCBrushColor)(PHYSDEV, COLORREF);
159     COLORREF (*pSetDCPenColor)(PHYSDEV, COLORREF);
160     UINT     (*pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*);
161     INT      (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,BITMAPINFO*,UINT);
162     VOID     (*pSetDeviceClipping)(PHYSDEV,HRGN,HRGN);
163     BOOL     (*pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
164     DWORD    (*pSetLayout)(PHYSDEV,DWORD);
165     INT      (*pSetMapMode)(PHYSDEV,INT);
166     DWORD    (*pSetMapperFlags)(PHYSDEV,DWORD);
167     COLORREF (*pSetPixel)(PHYSDEV,INT,INT,COLORREF);
168     BOOL     (*pSetPixelFormat)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
169     INT      (*pSetPolyFillMode)(PHYSDEV,INT);
170     INT      (*pSetROP2)(PHYSDEV,INT);
171     INT      (*pSetRelAbs)(PHYSDEV,INT);
172     INT      (*pSetStretchBltMode)(PHYSDEV,INT);
173     UINT     (*pSetTextAlign)(PHYSDEV,UINT);
174     INT      (*pSetTextCharacterExtra)(PHYSDEV,INT);
175     COLORREF (*pSetTextColor)(PHYSDEV,COLORREF);
176     BOOL     (*pSetTextJustification)(PHYSDEV,INT,INT);
177     BOOL     (*pSetViewportExtEx)(PHYSDEV,INT,INT,SIZE*);
178     BOOL     (*pSetViewportOrgEx)(PHYSDEV,INT,INT,POINT*);
179     BOOL     (*pSetWindowExtEx)(PHYSDEV,INT,INT,SIZE*);
180     BOOL     (*pSetWindowOrgEx)(PHYSDEV,INT,INT,POINT*);
181     BOOL     (*pSetWorldTransform)(PHYSDEV,const XFORM*);
182     INT      (*pStartDoc)(PHYSDEV,const DOCINFOW*);
183     INT      (*pStartPage)(PHYSDEV);
184     BOOL     (*pStretchBlt)(PHYSDEV,struct bitblt_coords*,PHYSDEV,struct bitblt_coords*,DWORD);
185     INT      (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void*,BITMAPINFO*,UINT,DWORD);
186     BOOL     (*pStrokeAndFillPath)(PHYSDEV);
187     BOOL     (*pStrokePath)(PHYSDEV);
188     BOOL     (*pSwapBuffers)(PHYSDEV);
189     BOOL     (*pUnrealizePalette)(HPALETTE);
190     BOOL     (*pWidenPath)(PHYSDEV);
191
192     /* OpenGL32 */
193     BOOL     (*pwglCopyContext)(HGLRC,HGLRC,UINT);
194     HGLRC    (*pwglCreateContext)(PHYSDEV);
195     HGLRC    (*pwglCreateContextAttribsARB)(PHYSDEV,HGLRC,const int*);
196     BOOL     (*pwglDeleteContext)(HGLRC);
197     HDC      (*pwglGetPbufferDCARB)(PHYSDEV,void*);
198     PROC     (*pwglGetProcAddress)(LPCSTR);
199     BOOL     (*pwglMakeContextCurrentARB)(PHYSDEV,PHYSDEV,HGLRC);
200     BOOL     (*pwglMakeCurrent)(PHYSDEV,HGLRC);
201     BOOL     (*pwglSetPixelFormatWINE)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR*);
202     BOOL     (*pwglShareLists)(HGLRC,HGLRC);
203     BOOL     (*pwglUseFontBitmapsA)(PHYSDEV,DWORD,DWORD,DWORD);
204     BOOL     (*pwglUseFontBitmapsW)(PHYSDEV,DWORD,DWORD,DWORD);
205 };
206
207 /* increment this when you change the DC function table */
208 #define WINE_GDI_DRIVER_VERSION 19
209
210 static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
211 {
212     while (!((void **)dev->funcs)[offset / sizeof(void *)]) dev = dev->next;
213     return dev;
214 }
215
216 #define GET_NEXT_PHYSDEV(dev,func) \
217     get_physdev_entry_point( (dev)->next, FIELD_OFFSET(struct gdi_dc_funcs,func))
218
219 static inline void push_dc_driver( PHYSDEV *dev, PHYSDEV physdev, const struct gdi_dc_funcs *funcs )
220 {
221     physdev->funcs = funcs;
222     physdev->next = *dev;
223     physdev->hdc = (*dev)->hdc;
224     *dev = physdev;
225 }
226
227 static inline PHYSDEV pop_dc_driver( PHYSDEV *dev )
228 {
229     PHYSDEV ret = *dev;
230     *dev = ret->next;
231     return ret;
232 }
233
234 #endif /* __WINE_WINE_GDI_DRIVER_H */