From 605b2e6d527b8057afa04a7b3cf34e8407459550 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 13 Jul 2011 14:05:07 +0200 Subject: [PATCH] winex11: Add a DC function structure and export it. --- dlls/winex11.drv/init.c | 154 +++++++++++++++++++++++++++++- dlls/winex11.drv/winex11.drv.spec | 2 + dlls/winex11.drv/x11drv.h | 99 ++++++++++++------- 3 files changed, 221 insertions(+), 34 deletions(-) diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index a36ba10514a..6f734b5b7f0 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -118,7 +118,7 @@ void X11DRV_GDI_Finalize(void) /********************************************************************** * X11DRV_CreateDC */ -BOOL CDECL X11DRV_CreateDC( HDC hdc, X11DRV_PDEVICE **pdev, LPCWSTR driver, LPCWSTR device, +BOOL CDECL X11DRV_CreateDC( HDC hdc, PHYSDEV *pdev, LPCWSTR driver, LPCWSTR device, LPCWSTR output, const DEVMODEW* initData ) { X11DRV_PDEVICE *physDev; @@ -128,7 +128,7 @@ BOOL CDECL X11DRV_CreateDC( HDC hdc, X11DRV_PDEVICE **pdev, LPCWSTR driver, LPCW physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) ); if (!physDev) return FALSE; - *pdev = physDev; + *pdev = &physDev->dev; if (GetObjectType( hdc ) == OBJ_MEMDC) { @@ -441,3 +441,153 @@ INT CDECL X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_da } return 0; } + + +static const struct gdi_dc_funcs x11drv_funcs = +{ + NULL, /* pAbortDoc */ + NULL, /* pAbortPath */ + X11DRV_AlphaBlend, /* pAlphaBlend */ + NULL, /* pAngleArc */ + X11DRV_Arc, /* pArc */ + NULL, /* pArcTo */ + NULL, /* pBeginPath */ + X11DRV_ChoosePixelFormat, /* pChoosePixelFormat */ + X11DRV_Chord, /* pChord */ + NULL, /* pCloseFigure */ + X11DRV_CreateBitmap, /* pCreateBitmap */ + X11DRV_CreateDC, /* pCreateDC */ + X11DRV_CreateDIBSection, /* pCreateDIBSection */ + X11DRV_DeleteBitmap, /* pDeleteBitmap */ + X11DRV_DeleteDC, /* pDeleteDC */ + NULL, /* pDeleteObject */ + X11DRV_DescribePixelFormat, /* pDescribePixelFormat */ + NULL, /* pDeviceCapabilities */ + X11DRV_Ellipse, /* pEllipse */ + NULL, /* pEndDoc */ + NULL, /* pEndPage */ + NULL, /* pEndPath */ + X11DRV_EnumDeviceFonts, /* pEnumDeviceFonts */ + X11DRV_EnumICMProfiles, /* pEnumICMProfiles */ + NULL, /* pExcludeClipRect */ + NULL, /* pExtDeviceMode */ + X11DRV_ExtEscape, /* pExtEscape */ + X11DRV_ExtFloodFill, /* pExtFloodFill */ + NULL, /* pExtSelectClipRgn */ + X11DRV_ExtTextOut, /* pExtTextOut */ + NULL, /* pFillPath */ + NULL, /* pFillRgn */ + NULL, /* pFlattenPath */ + NULL, /* pFrameRgn */ + NULL, /* pGdiComment */ + X11DRV_GetBitmapBits, /* pGetBitmapBits */ + X11DRV_GetCharWidth, /* pGetCharWidth */ + X11DRV_GetDIBits, /* pGetDIBits */ + X11DRV_GetDeviceCaps, /* pGetDeviceCaps */ + X11DRV_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */ + X11DRV_GetICMProfile, /* pGetICMProfile */ + X11DRV_GetNearestColor, /* pGetNearestColor */ + X11DRV_GetPixel, /* pGetPixel */ + X11DRV_GetPixelFormat, /* pGetPixelFormat */ + X11DRV_GetSystemPaletteEntries, /* pGetSystemPaletteEntries */ + X11DRV_GetTextExtentExPoint, /* pGetTextExtentExPoint */ + X11DRV_GetTextMetrics, /* pGetTextMetrics */ + NULL, /* pIntersectClipRect */ + NULL, /* pInvertRgn */ + X11DRV_LineTo, /* pLineTo */ + NULL, /* pModifyWorldTransform */ + NULL, /* pMoveTo */ + NULL, /* pOffsetClipRgn */ + NULL, /* pOffsetViewportOrg */ + NULL, /* pOffsetWindowOrg */ + X11DRV_PaintRgn, /* pPaintRgn */ + X11DRV_PatBlt, /* pPatBlt */ + X11DRV_Pie, /* pPie */ + NULL, /* pPolyBezier */ + NULL, /* pPolyBezierTo */ + NULL, /* pPolyDraw */ + X11DRV_PolyPolygon, /* pPolyPolygon */ + X11DRV_PolyPolyline, /* pPolyPolyline */ + X11DRV_Polygon, /* pPolygon */ + X11DRV_Polyline, /* pPolyline */ + NULL, /* pPolylineTo */ + X11DRV_RealizeDefaultPalette, /* pRealizeDefaultPalette */ + X11DRV_RealizePalette, /* pRealizePalette */ + X11DRV_Rectangle, /* pRectangle */ + NULL, /* pResetDC */ + NULL, /* pRestoreDC */ + X11DRV_RoundRect, /* pRoundRect */ + NULL, /* pSaveDC */ + NULL, /* pScaleViewportExt */ + NULL, /* pScaleWindowExt */ + X11DRV_SelectBitmap, /* pSelectBitmap */ + X11DRV_SelectBrush, /* pSelectBrush */ + NULL, /* pSelectClipPath */ + X11DRV_SelectFont, /* pSelectFont */ + NULL, /* pSelectPalette */ + X11DRV_SelectPen, /* pSelectPen */ + NULL, /* pSetArcDirection */ + X11DRV_SetBitmapBits, /* pSetBitmapBits */ + X11DRV_SetBkColor, /* pSetBkColor */ + NULL, /* pSetBkMode */ + X11DRV_SetDCBrushColor, /* pSetDCBrushColor */ + X11DRV_SetDCPenColor, /* pSetDCPenColor */ + X11DRV_SetDIBColorTable, /* pSetDIBColorTable */ + X11DRV_SetDIBits, /* pSetDIBits */ + X11DRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */ + X11DRV_SetDeviceClipping, /* pSetDeviceClipping */ + X11DRV_SetDeviceGammaRamp, /* pSetDeviceGammaRamp */ + NULL, /* pSetLayout */ + NULL, /* pSetMapMode */ + NULL, /* pSetMapperFlags */ + X11DRV_SetPixel, /* pSetPixel */ + X11DRV_SetPixelFormat, /* pSetPixelFormat */ + NULL, /* pSetPolyFillMode */ + NULL, /* pSetROP2 */ + NULL, /* pSetRelAbs */ + NULL, /* pSetStretchBltMode */ + NULL, /* pSetTextAlign */ + NULL, /* pSetTextCharacterExtra */ + X11DRV_SetTextColor, /* pSetTextColor */ + NULL, /* pSetTextJustification */ + NULL, /* pSetViewportExt */ + NULL, /* pSetViewportOrg */ + NULL, /* pSetWindowExt */ + NULL, /* pSetWindowOrg */ + NULL, /* pSetWorldTransform */ + NULL, /* pStartDoc */ + NULL, /* pStartPage */ + X11DRV_StretchBlt, /* pStretchBlt */ + NULL, /* pStretchDIBits */ + NULL, /* pStrokeAndFillPath */ + NULL, /* pStrokePath */ + X11DRV_SwapBuffers, /* pSwapBuffers */ + X11DRV_UnrealizePalette, /* pUnrealizePalette */ + NULL, /* pWidenPath */ + X11DRV_wglCopyContext, /* pwglCopyContext */ + X11DRV_wglCreateContext, /* pwglCreateContext */ + X11DRV_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */ + X11DRV_wglDeleteContext, /* pwglDeleteContext */ + X11DRV_wglGetProcAddress, /* pwglGetProcAddress */ + X11DRV_wglGetPbufferDCARB, /* pwglGetPbufferDCARB */ + X11DRV_wglMakeCurrent, /* pwglMakeCurrent */ + X11DRV_wglMakeContextCurrentARB, /* pwglMakeContextCurrentARB */ + X11DRV_wglSetPixelFormatWINE, /* pwglSetPixelFormatWINE */ + X11DRV_wglShareLists, /* pwglShareLists */ + X11DRV_wglUseFontBitmapsA, /* pwglUseFontBitmapsA */ + X11DRV_wglUseFontBitmapsW, /* pwglUseFontBitmapsW */ +}; + + +/****************************************************************************** + * X11DRV_get_gdi_driver + */ +const struct gdi_dc_funcs * CDECL X11DRV_get_gdi_driver( unsigned int version ) +{ + if (version != WINE_GDI_DRIVER_VERSION) + { + ERR( "version mismatch, gdi32 wants %u but winex11 has %u\n", version, WINE_GDI_DRIVER_VERSION ); + return NULL; + } + return &x11drv_funcs; +} diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index 0c63c15383b..ef97cddd905 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -1,5 +1,7 @@ # GDI driver +@ cdecl wine_get_gdi_driver(long) X11DRV_get_gdi_driver + @ cdecl AlphaBlend(ptr ptr ptr ptr long) X11DRV_AlphaBlend @ cdecl Arc(ptr long long long long long long long long) X11DRV_Arc @ cdecl ChoosePixelFormat(ptr ptr) X11DRV_ChoosePixelFormat diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 8bbf04dc12f..320bc237aee 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -180,57 +180,92 @@ extern GC get_bitmap_gc(int depth) DECLSPEC_HIDDEN; /* Wine driver X11 functions */ +extern BOOL CDECL X11DRV_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, + PHYSDEV src_dev, struct bitblt_coords *src, + BLENDFUNCTION blendfn ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_Arc( PHYSDEV dev, INT left, INT top, INT right, + INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_Chord( PHYSDEV dev, INT left, INT top, + INT right, INT bottom, INT xstart, + INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_CreateBitmap( PHYSDEV dev, HBITMAP hbitmap, LPVOID bmBits ) DECLSPEC_HIDDEN; +extern HBITMAP CDECL X11DRV_CreateDIBSection( PHYSDEV dev, HBITMAP hbitmap, + const BITMAPINFO *bmi, UINT usage ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_DeleteBitmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_Ellipse( PHYSDEV dev, INT left, INT top, + INT right, INT bottom ) DECLSPEC_HIDDEN; extern BOOL CDECL X11DRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW dfeproc, LPARAM lp ) DECLSPEC_HIDDEN; +extern INT CDECL X11DRV_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW proc, LPARAM lparam ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, + COLORREF color, UINT fillType ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, + UINT flags, const RECT *lprect, + LPCWSTR str, UINT count, const INT *lpDx ) DECLSPEC_HIDDEN; extern LONG CDECL X11DRV_GetBitmapBits( HBITMAP hbitmap, void *bits, LONG count ) DECLSPEC_HIDDEN; extern BOOL CDECL X11DRV_GetCharWidth( PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_GetDeviceGammaRamp( PHYSDEV dev, LPVOID ramp ) DECLSPEC_HIDDEN; +extern INT CDECL X11DRV_GetDIBits( PHYSDEV dev, HBITMAP hbitmap, UINT startscan, UINT lines, + LPVOID bits, BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename ) DECLSPEC_HIDDEN; +extern COLORREF CDECL X11DRV_GetNearestColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; +extern COLORREF CDECL X11DRV_GetPixel( PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN; +extern UINT CDECL X11DRV_GetSystemPaletteEntries( PHYSDEV dev, UINT start, UINT count, LPPALETTEENTRY entries ) DECLSPEC_HIDDEN; extern BOOL CDECL X11DRV_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count, INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size ) DECLSPEC_HIDDEN; extern BOOL CDECL X11DRV_GetTextMetrics(PHYSDEV dev, TEXTMETRICW *metrics) DECLSPEC_HIDDEN; extern BOOL CDECL X11DRV_LineTo( PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN; -extern BOOL CDECL X11DRV_Arc( PHYSDEV dev, INT left, INT top, INT right, - INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; -extern BOOL CDECL X11DRV_Pie( PHYSDEV dev, INT left, INT top, INT right, - INT bottom, INT xstart, INT ystart, INT xend, - INT yend ) DECLSPEC_HIDDEN; -extern BOOL CDECL X11DRV_Chord( PHYSDEV dev, INT left, INT top, - INT right, INT bottom, INT xstart, - INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; -extern BOOL CDECL X11DRV_Ellipse( PHYSDEV dev, INT left, INT top, - INT right, INT bottom ) DECLSPEC_HIDDEN; -extern BOOL CDECL X11DRV_Rectangle(PHYSDEV dev, INT left, INT top, - INT right, INT bottom) DECLSPEC_HIDDEN; -extern BOOL CDECL X11DRV_RoundRect( PHYSDEV dev, INT left, INT top, - INT right, INT bottom, INT ell_width, - INT ell_height ) DECLSPEC_HIDDEN; -extern COLORREF CDECL X11DRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN; -extern COLORREF CDECL X11DRV_GetPixel( PHYSDEV dev, INT x, INT y) DECLSPEC_HIDDEN; extern BOOL CDECL X11DRV_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_Pie( PHYSDEV dev, INT left, INT top, INT right, + INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; extern BOOL CDECL X11DRV_Polyline( PHYSDEV dev,const POINT* pt,INT count) DECLSPEC_HIDDEN; extern BOOL CDECL X11DRV_Polygon( PHYSDEV dev, const POINT* pt, INT count ) DECLSPEC_HIDDEN; extern BOOL CDECL X11DRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polygons) DECLSPEC_HIDDEN; extern BOOL CDECL X11DRV_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWORD polylines) DECLSPEC_HIDDEN; - -extern COLORREF CDECL X11DRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; -extern COLORREF CDECL X11DRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; -extern BOOL CDECL X11DRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, - COLORREF color, UINT fillType ) DECLSPEC_HIDDEN; -extern BOOL CDECL X11DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, - UINT flags, const RECT *lprect, - LPCWSTR str, UINT count, const INT *lpDx ) DECLSPEC_HIDDEN; +extern UINT CDECL X11DRV_RealizeDefaultPalette( PHYSDEV dev ) DECLSPEC_HIDDEN; +extern UINT CDECL X11DRV_RealizePalette( PHYSDEV dev, HPALETTE hpal, BOOL primary ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_Rectangle(PHYSDEV dev, INT left, INT top, + INT right, INT bottom) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_RoundRect( PHYSDEV dev, INT left, INT top, + INT right, INT bottom, INT ell_width, + INT ell_height ) DECLSPEC_HIDDEN; +extern HBITMAP CDECL X11DRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap ) DECLSPEC_HIDDEN; +extern HBRUSH CDECL X11DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush ) DECLSPEC_HIDDEN; +extern HFONT CDECL X11DRV_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) DECLSPEC_HIDDEN; +extern HPEN CDECL X11DRV_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN; extern LONG CDECL X11DRV_SetBitmapBits( HBITMAP hbitmap, const void *bits, LONG count ) DECLSPEC_HIDDEN; +extern COLORREF CDECL X11DRV_SetBkColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; +extern COLORREF CDECL X11DRV_SetDCBrushColor( PHYSDEV dev, COLORREF crColor ) DECLSPEC_HIDDEN; +extern COLORREF CDECL X11DRV_SetDCPenColor( PHYSDEV dev, COLORREF crColor ) DECLSPEC_HIDDEN; extern void CDECL X11DRV_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip_rgn ) DECLSPEC_HIDDEN; -extern INT CDECL X11DRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, - INT yDest, DWORD cx, DWORD cy, - INT xSrc, INT ySrc, - UINT startscan, UINT lines, - LPCVOID bits, const BITMAPINFO *info, - UINT coloruse ) DECLSPEC_HIDDEN; -extern BOOL CDECL X11DRV_GetDeviceGammaRamp( PHYSDEV dev, LPVOID ramp ) DECLSPEC_HIDDEN; extern BOOL CDECL X11DRV_SetDeviceGammaRamp( PHYSDEV dev, LPVOID ramp ) DECLSPEC_HIDDEN; +extern UINT CDECL X11DRV_SetDIBColorTable( PHYSDEV dev, UINT start, UINT count, const RGBQUAD *colors ) DECLSPEC_HIDDEN; +extern INT CDECL X11DRV_SetDIBits( PHYSDEV dev, HBITMAP hbitmap, UINT startscan, + UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN; +extern INT CDECL X11DRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc, INT ySrc, + UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse ) DECLSPEC_HIDDEN; +extern COLORREF CDECL X11DRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_SetPixelFormat(PHYSDEV dev, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd) DECLSPEC_HIDDEN; +extern COLORREF CDECL X11DRV_SetTextColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, + PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_UnrealizePalette( HPALETTE hpal ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_wglCopyContext( HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask ) DECLSPEC_HIDDEN; +extern HGLRC CDECL X11DRV_wglCreateContext( PHYSDEV dev ) DECLSPEC_HIDDEN; +extern HGLRC CDECL X11DRV_wglCreateContextAttribsARB( PHYSDEV dev, HGLRC hShareContext, const int* attribList ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_wglDeleteContext( HGLRC hglrc ) DECLSPEC_HIDDEN; +extern PROC CDECL X11DRV_wglGetProcAddress( LPCSTR proc ) DECLSPEC_HIDDEN; +extern HDC CDECL X11DRV_wglGetPbufferDCARB( PHYSDEV dev, void *pbuffer ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_wglMakeContextCurrentARB( PHYSDEV draw_dev, PHYSDEV read_dev, HGLRC hglrc ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_wglMakeCurrent( PHYSDEV dev, HGLRC hglrc ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_wglSetPixelFormatWINE( PHYSDEV dev, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_wglShareLists( HGLRC hglrc1, HGLRC hglrc2 ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_wglUseFontBitmapsA( PHYSDEV dev, DWORD first, DWORD count, DWORD listBase ) DECLSPEC_HIDDEN; +extern BOOL CDECL X11DRV_wglUseFontBitmapsW( PHYSDEV dev, DWORD first, DWORD count, DWORD listBase ) DECLSPEC_HIDDEN; /* OpenGL / X11 driver functions */ extern int CDECL X11DRV_ChoosePixelFormat(PHYSDEV dev,