2011-07-07 12:43:51 +02:00
|
|
|
/*
|
|
|
|
* Definitions for Wine GDI drivers
|
|
|
|
*
|
|
|
|
* Copyright 2011 Alexandre Julliard
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_WINE_GDI_DRIVER_H
|
|
|
|
#define __WINE_WINE_GDI_DRIVER_H
|
|
|
|
|
2019-10-22 10:38:56 +02:00
|
|
|
#include "winternl.h"
|
|
|
|
#include "ddk/d3dkmthk.h"
|
2012-09-06 12:23:10 +02:00
|
|
|
#include "wine/list.h"
|
|
|
|
|
2011-07-07 12:43:51 +02:00
|
|
|
struct gdi_dc_funcs;
|
2012-07-18 23:58:41 +02:00
|
|
|
struct opengl_funcs;
|
2018-02-26 19:42:15 +01:00
|
|
|
struct vulkan_funcs;
|
2011-07-07 12:43:51 +02:00
|
|
|
|
|
|
|
typedef struct gdi_physdev
|
|
|
|
{
|
|
|
|
const struct gdi_dc_funcs *funcs;
|
|
|
|
struct gdi_physdev *next;
|
|
|
|
HDC hdc;
|
|
|
|
} *PHYSDEV;
|
|
|
|
|
2011-07-11 13:44:26 +02:00
|
|
|
struct bitblt_coords
|
|
|
|
{
|
|
|
|
int log_x; /* original position and size, in logical coords */
|
|
|
|
int log_y;
|
|
|
|
int log_width;
|
|
|
|
int log_height;
|
|
|
|
int x; /* mapped position and size, in device coords */
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
RECT visrect; /* rectangle clipped to the visible part, in device coords */
|
|
|
|
DWORD layout; /* DC layout */
|
|
|
|
};
|
|
|
|
|
2011-07-14 11:30:58 +02:00
|
|
|
struct gdi_image_bits
|
|
|
|
{
|
2011-07-21 12:03:30 +02:00
|
|
|
void *ptr; /* pointer to the bits */
|
|
|
|
BOOL is_copy; /* whether this is a copy of the bits that can be modified */
|
2020-09-22 10:26:25 +02:00
|
|
|
void (CDECL *free)(struct gdi_image_bits *); /* callback for freeing the bits */
|
2011-07-21 12:03:30 +02:00
|
|
|
void *param; /* extra parameter for callback private use */
|
2011-07-14 11:30:58 +02:00
|
|
|
};
|
|
|
|
|
2011-12-29 19:49:41 +01:00
|
|
|
struct brush_pattern
|
|
|
|
{
|
|
|
|
BITMAPINFO *info; /* DIB info */
|
|
|
|
struct gdi_image_bits bits; /* DIB bits */
|
|
|
|
UINT usage; /* color usage for DIB info */
|
|
|
|
};
|
|
|
|
|
2011-07-13 12:28:16 +02:00
|
|
|
struct gdi_dc_funcs
|
|
|
|
{
|
2019-07-06 20:45:50 +02:00
|
|
|
INT (CDECL *pAbortDoc)(PHYSDEV);
|
|
|
|
BOOL (CDECL *pAbortPath)(PHYSDEV);
|
|
|
|
BOOL (CDECL *pAlphaBlend)(PHYSDEV,struct bitblt_coords*,PHYSDEV,struct bitblt_coords*,BLENDFUNCTION);
|
|
|
|
BOOL (CDECL *pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
|
|
|
|
BOOL (CDECL *pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
|
|
|
|
BOOL (CDECL *pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
|
|
|
|
BOOL (CDECL *pBeginPath)(PHYSDEV);
|
|
|
|
DWORD (CDECL *pBlendImage)(PHYSDEV,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,BLENDFUNCTION);
|
|
|
|
BOOL (CDECL *pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
|
|
|
|
BOOL (CDECL *pCloseFigure)(PHYSDEV);
|
|
|
|
BOOL (CDECL *pCreateCompatibleDC)(PHYSDEV,PHYSDEV*);
|
2021-09-29 14:07:26 +02:00
|
|
|
BOOL (CDECL *pCreateDC)(PHYSDEV*,LPCWSTR,LPCWSTR,const DEVMODEW*);
|
2019-07-06 20:45:50 +02:00
|
|
|
BOOL (CDECL *pDeleteDC)(PHYSDEV);
|
|
|
|
BOOL (CDECL *pDeleteObject)(PHYSDEV,HGDIOBJ);
|
|
|
|
BOOL (CDECL *pEllipse)(PHYSDEV,INT,INT,INT,INT);
|
|
|
|
INT (CDECL *pEndDoc)(PHYSDEV);
|
|
|
|
INT (CDECL *pEndPage)(PHYSDEV);
|
|
|
|
BOOL (CDECL *pEndPath)(PHYSDEV);
|
|
|
|
BOOL (CDECL *pEnumFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
|
|
|
|
INT (CDECL *pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
|
|
|
|
BOOL (CDECL *pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
|
|
|
|
BOOL (CDECL *pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
|
|
|
|
BOOL (CDECL *pFillPath)(PHYSDEV);
|
|
|
|
BOOL (CDECL *pFillRgn)(PHYSDEV,HRGN,HBRUSH);
|
|
|
|
BOOL (CDECL *pFontIsLinked)(PHYSDEV);
|
|
|
|
BOOL (CDECL *pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
|
|
|
|
UINT (CDECL *pGetBoundsRect)(PHYSDEV,RECT*,UINT);
|
2021-08-27 14:51:49 +02:00
|
|
|
BOOL (CDECL *pGetCharABCWidths)(PHYSDEV,UINT,UINT,WCHAR*,LPABC);
|
2019-07-06 20:45:50 +02:00
|
|
|
BOOL (CDECL *pGetCharABCWidthsI)(PHYSDEV,UINT,UINT,WORD*,LPABC);
|
2021-08-26 14:45:15 +02:00
|
|
|
BOOL (CDECL *pGetCharWidth)(PHYSDEV,UINT,UINT,const WCHAR*,LPINT);
|
2019-07-06 20:45:50 +02:00
|
|
|
BOOL (CDECL *pGetCharWidthInfo)(PHYSDEV,void*);
|
|
|
|
INT (CDECL *pGetDeviceCaps)(PHYSDEV,INT);
|
|
|
|
BOOL (CDECL *pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
|
|
|
|
DWORD (CDECL *pGetFontData)(PHYSDEV,DWORD,DWORD,LPVOID,DWORD);
|
|
|
|
BOOL (CDECL *pGetFontRealizationInfo)(PHYSDEV,void*);
|
|
|
|
DWORD (CDECL *pGetFontUnicodeRanges)(PHYSDEV,LPGLYPHSET);
|
|
|
|
DWORD (CDECL *pGetGlyphIndices)(PHYSDEV,LPCWSTR,INT,LPWORD,DWORD);
|
|
|
|
DWORD (CDECL *pGetGlyphOutline)(PHYSDEV,UINT,UINT,LPGLYPHMETRICS,DWORD,LPVOID,const MAT2*);
|
2021-09-09 14:01:51 +02:00
|
|
|
BOOL (CDECL *pGetICMProfile)(PHYSDEV,BOOL,LPDWORD,LPWSTR);
|
2019-07-06 20:45:50 +02:00
|
|
|
DWORD (CDECL *pGetImage)(PHYSDEV,BITMAPINFO*,struct gdi_image_bits*,struct bitblt_coords*);
|
|
|
|
DWORD (CDECL *pGetKerningPairs)(PHYSDEV,DWORD,LPKERNINGPAIR);
|
|
|
|
COLORREF (CDECL *pGetNearestColor)(PHYSDEV,COLORREF);
|
|
|
|
UINT (CDECL *pGetOutlineTextMetrics)(PHYSDEV,UINT,LPOUTLINETEXTMETRICW);
|
|
|
|
COLORREF (CDECL *pGetPixel)(PHYSDEV,INT,INT);
|
|
|
|
UINT (CDECL *pGetSystemPaletteEntries)(PHYSDEV,UINT,UINT,LPPALETTEENTRY);
|
|
|
|
UINT (CDECL *pGetTextCharsetInfo)(PHYSDEV,LPFONTSIGNATURE,DWORD);
|
|
|
|
BOOL (CDECL *pGetTextExtentExPoint)(PHYSDEV,LPCWSTR,INT,LPINT);
|
|
|
|
BOOL (CDECL *pGetTextExtentExPointI)(PHYSDEV,const WORD*,INT,LPINT);
|
|
|
|
INT (CDECL *pGetTextFace)(PHYSDEV,INT,LPWSTR);
|
|
|
|
BOOL (CDECL *pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
|
|
|
|
BOOL (CDECL *pGradientFill)(PHYSDEV,TRIVERTEX*,ULONG,void*,ULONG,ULONG);
|
|
|
|
BOOL (CDECL *pInvertRgn)(PHYSDEV,HRGN);
|
|
|
|
BOOL (CDECL *pLineTo)(PHYSDEV,INT,INT);
|
|
|
|
BOOL (CDECL *pMoveTo)(PHYSDEV,INT,INT);
|
|
|
|
BOOL (CDECL *pPaintRgn)(PHYSDEV,HRGN);
|
|
|
|
BOOL (CDECL *pPatBlt)(PHYSDEV,struct bitblt_coords*,DWORD);
|
|
|
|
BOOL (CDECL *pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
|
|
|
|
BOOL (CDECL *pPolyBezier)(PHYSDEV,const POINT*,DWORD);
|
|
|
|
BOOL (CDECL *pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
|
|
|
|
BOOL (CDECL *pPolyDraw)(PHYSDEV,const POINT*,const BYTE *,DWORD);
|
|
|
|
BOOL (CDECL *pPolyPolygon)(PHYSDEV,const POINT*,const INT*,UINT);
|
|
|
|
BOOL (CDECL *pPolyPolyline)(PHYSDEV,const POINT*,const DWORD*,DWORD);
|
|
|
|
BOOL (CDECL *pPolylineTo)(PHYSDEV,const POINT*,INT);
|
|
|
|
DWORD (CDECL *pPutImage)(PHYSDEV,HRGN,BITMAPINFO*,const struct gdi_image_bits*,struct bitblt_coords*,struct bitblt_coords*,DWORD);
|
|
|
|
UINT (CDECL *pRealizeDefaultPalette)(PHYSDEV);
|
|
|
|
UINT (CDECL *pRealizePalette)(PHYSDEV,HPALETTE,BOOL);
|
|
|
|
BOOL (CDECL *pRectangle)(PHYSDEV,INT,INT,INT,INT);
|
2021-08-23 13:50:47 +02:00
|
|
|
BOOL (CDECL *pResetDC)(PHYSDEV,const DEVMODEW*);
|
2019-07-06 20:45:50 +02:00
|
|
|
BOOL (CDECL *pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
|
|
|
|
HBITMAP (CDECL *pSelectBitmap)(PHYSDEV,HBITMAP);
|
|
|
|
HBRUSH (CDECL *pSelectBrush)(PHYSDEV,HBRUSH,const struct brush_pattern*);
|
|
|
|
HFONT (CDECL *pSelectFont)(PHYSDEV,HFONT,UINT*);
|
|
|
|
HPEN (CDECL *pSelectPen)(PHYSDEV,HPEN,const struct brush_pattern*);
|
|
|
|
COLORREF (CDECL *pSetBkColor)(PHYSDEV,COLORREF);
|
|
|
|
UINT (CDECL *pSetBoundsRect)(PHYSDEV,RECT*,UINT);
|
|
|
|
COLORREF (CDECL *pSetDCBrushColor)(PHYSDEV, COLORREF);
|
|
|
|
COLORREF (CDECL *pSetDCPenColor)(PHYSDEV, COLORREF);
|
|
|
|
INT (CDECL *pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,BITMAPINFO*,UINT);
|
|
|
|
VOID (CDECL *pSetDeviceClipping)(PHYSDEV,HRGN);
|
|
|
|
BOOL (CDECL *pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
|
|
|
|
COLORREF (CDECL *pSetPixel)(PHYSDEV,INT,INT,COLORREF);
|
|
|
|
COLORREF (CDECL *pSetTextColor)(PHYSDEV,COLORREF);
|
|
|
|
INT (CDECL *pStartDoc)(PHYSDEV,const DOCINFOW*);
|
|
|
|
INT (CDECL *pStartPage)(PHYSDEV);
|
|
|
|
BOOL (CDECL *pStretchBlt)(PHYSDEV,struct bitblt_coords*,PHYSDEV,struct bitblt_coords*,DWORD);
|
|
|
|
INT (CDECL *pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void*,BITMAPINFO*,UINT,DWORD);
|
|
|
|
BOOL (CDECL *pStrokeAndFillPath)(PHYSDEV);
|
|
|
|
BOOL (CDECL *pStrokePath)(PHYSDEV);
|
|
|
|
BOOL (CDECL *pUnrealizePalette)(HPALETTE);
|
2019-10-22 10:38:56 +02:00
|
|
|
NTSTATUS (CDECL *pD3DKMTCheckVidPnExclusiveOwnership)(const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *);
|
|
|
|
NTSTATUS (CDECL *pD3DKMTSetVidPnSourceOwner)(const D3DKMT_SETVIDPNSOURCEOWNER *);
|
2019-07-06 20:45:50 +02:00
|
|
|
struct opengl_funcs * (CDECL *wine_get_wgl_driver)(PHYSDEV,UINT);
|
|
|
|
const struct vulkan_funcs * (CDECL *wine_get_vulkan_driver)(PHYSDEV,UINT);
|
2012-05-08 12:16:05 +02:00
|
|
|
|
|
|
|
/* priority order for the driver on the stack */
|
|
|
|
UINT priority;
|
2011-07-13 12:28:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* increment this when you change the DC function table */
|
2021-09-29 14:07:26 +02:00
|
|
|
#define WINE_GDI_DRIVER_VERSION 69
|
2012-05-08 12:16:05 +02:00
|
|
|
|
|
|
|
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */
|
|
|
|
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */
|
|
|
|
#define GDI_PRIORITY_GRAPHICS_DRV 200 /* any graphics driver */
|
|
|
|
#define GDI_PRIORITY_DIB_DRV 300 /* the DIB driver */
|
|
|
|
#define GDI_PRIORITY_PATH_DRV 400 /* the path driver */
|
2011-07-13 12:28:16 +02:00
|
|
|
|
|
|
|
static inline PHYSDEV get_physdev_entry_point( PHYSDEV dev, size_t offset )
|
|
|
|
{
|
|
|
|
while (!((void **)dev->funcs)[offset / sizeof(void *)]) dev = dev->next;
|
|
|
|
return dev;
|
|
|
|
}
|
|
|
|
|
2011-07-06 17:35:17 +02:00
|
|
|
#define GET_NEXT_PHYSDEV(dev,func) \
|
|
|
|
get_physdev_entry_point( (dev)->next, FIELD_OFFSET(struct gdi_dc_funcs,func))
|
2011-07-13 12:28:16 +02:00
|
|
|
|
2011-09-07 14:39:46 +02:00
|
|
|
static inline void push_dc_driver( PHYSDEV *dev, PHYSDEV physdev, const struct gdi_dc_funcs *funcs )
|
|
|
|
{
|
2012-05-08 12:16:05 +02:00
|
|
|
while ((*dev)->funcs->priority > funcs->priority) dev = &(*dev)->next;
|
2011-09-07 14:39:46 +02:00
|
|
|
physdev->funcs = funcs;
|
|
|
|
physdev->next = *dev;
|
|
|
|
physdev->hdc = (*dev)->hdc;
|
|
|
|
*dev = physdev;
|
|
|
|
}
|
|
|
|
|
2012-09-06 12:23:10 +02:00
|
|
|
/* support for window surfaces */
|
|
|
|
|
|
|
|
struct window_surface;
|
|
|
|
|
|
|
|
struct window_surface_funcs
|
|
|
|
{
|
2020-09-22 10:26:26 +02:00
|
|
|
void (CDECL *lock)( struct window_surface *surface );
|
|
|
|
void (CDECL *unlock)( struct window_surface *surface );
|
|
|
|
void* (CDECL *get_info)( struct window_surface *surface, BITMAPINFO *info );
|
|
|
|
RECT* (CDECL *get_bounds)( struct window_surface *surface );
|
|
|
|
void (CDECL *set_region)( struct window_surface *surface, HRGN region );
|
|
|
|
void (CDECL *flush)( struct window_surface *surface );
|
|
|
|
void (CDECL *destroy)( struct window_surface *surface );
|
2012-09-06 12:23:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct window_surface
|
|
|
|
{
|
|
|
|
const struct window_surface_funcs *funcs; /* driver-specific implementations */
|
|
|
|
struct list entry; /* entry in global list managed by user32 */
|
|
|
|
LONG ref; /* reference count */
|
|
|
|
RECT rect; /* constant, no locking needed */
|
|
|
|
/* driver-specific fields here */
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline ULONG window_surface_add_ref( struct window_surface *surface )
|
|
|
|
{
|
|
|
|
return InterlockedIncrement( &surface->ref );
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline ULONG window_surface_release( struct window_surface *surface )
|
|
|
|
{
|
|
|
|
ULONG ret = InterlockedDecrement( &surface->ref );
|
|
|
|
if (!ret) surface->funcs->destroy( surface );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-05-31 11:44:23 +02:00
|
|
|
/* the DC hook support is only exported on Win16, the 32-bit version is a Wine extension */
|
|
|
|
|
|
|
|
#define DCHC_INVALIDVISRGN 0x0001
|
|
|
|
#define DCHC_DELETEDC 0x0002
|
|
|
|
#define DCHF_INVALIDATEVISRGN 0x0001
|
|
|
|
#define DCHF_VALIDATEVISRGN 0x0002
|
2012-10-24 18:24:03 +02:00
|
|
|
#define DCHF_RESETDC 0x0004 /* Wine extension */
|
2017-01-26 10:30:19 +01:00
|
|
|
#define DCHF_DISABLEDC 0x0008 /* Wine extension */
|
|
|
|
#define DCHF_ENABLEDC 0x0010 /* Wine extension */
|
2012-05-31 11:44:23 +02:00
|
|
|
|
|
|
|
typedef BOOL (CALLBACK *DCHOOKPROC)(HDC,WORD,DWORD_PTR,LPARAM);
|
|
|
|
|
|
|
|
WINGDIAPI DWORD_PTR WINAPI GetDCHook(HDC,DCHOOKPROC*);
|
|
|
|
WINGDIAPI BOOL WINAPI SetDCHook(HDC,DCHOOKPROC,DWORD_PTR);
|
|
|
|
WINGDIAPI WORD WINAPI SetHookFlags(HDC,WORD);
|
|
|
|
|
|
|
|
extern void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set );
|
2012-09-05 19:29:29 +02:00
|
|
|
extern void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect,
|
2012-09-06 12:23:10 +02:00
|
|
|
const RECT *device_rect, struct window_surface *surface );
|
2013-10-29 12:39:46 +01:00
|
|
|
extern void CDECL __wine_set_display_driver( HMODULE module );
|
2012-07-18 23:58:41 +02:00
|
|
|
extern struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version );
|
2018-02-26 19:42:15 +01:00
|
|
|
extern const struct vulkan_funcs * CDECL __wine_get_vulkan_driver( HDC hdc, UINT version );
|
2012-05-31 11:44:23 +02:00
|
|
|
|
2011-07-07 12:43:51 +02:00
|
|
|
#endif /* __WINE_WINE_GDI_DRIVER_H */
|