gdi32: Move DescribePixelFormat and SetPixelFormat to the WGL driver.

This commit is contained in:
Alexandre Julliard 2012-07-30 21:53:37 +02:00
parent 0316a1b4c1
commit 96e80c2623
19 changed files with 88 additions and 157 deletions

View File

@ -421,7 +421,6 @@ const struct gdi_dc_funcs dib_driver =
dibdrv_CreateDC, /* pCreateDC */
dibdrv_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
dibdrv_DescribePixelFormat, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
dibdrv_Ellipse, /* pEllipse */
NULL, /* pEndDoc */
@ -513,7 +512,6 @@ const struct gdi_dc_funcs dib_driver =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
dibdrv_SetPixel, /* pSetPixel */
dibdrv_SetPixelFormat, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */

View File

@ -114,7 +114,6 @@ extern DWORD dibdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct g
struct bitblt_coords *src, struct bitblt_coords *dst, BLENDFUNCTION func ) DECLSPEC_HIDDEN;
extern BOOL dibdrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT start_x, INT start_y, INT end_x, INT end_y ) DECLSPEC_HIDDEN;
extern int dibdrv_DescribePixelFormat( PHYSDEV dev, int fmt, UINT size, PIXELFORMATDESCRIPTOR *descr ) DECLSPEC_HIDDEN;
extern BOOL dibdrv_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
extern BOOL dibdrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT type ) DECLSPEC_HIDDEN;
extern BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
@ -146,7 +145,6 @@ extern HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pat
extern COLORREF dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF dibdrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN;
extern BOOL dibdrv_SetPixelFormat( PHYSDEV dev, int fmt, const PIXELFORMATDESCRIPTOR *descr ) DECLSPEC_HIDDEN;
extern BOOL dibdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop ) DECLSPEC_HIDDEN;
extern struct opengl_funcs *dibdrv_wine_get_wgl_driver( PHYSDEV dev, UINT version ) DECLSPEC_HIDDEN;

View File

@ -40,6 +40,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dib);
#include "wine/wgl_driver.h"
extern BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT fmt, const PIXELFORMATDESCRIPTOR *pfd );
struct wgl_context
{
OSMesaContext context;
@ -135,9 +137,9 @@ failed:
}
/**********************************************************************
* dibdrv_DescribePixelFormat
* dibdrv_wglDescribePixelFormat
*/
int dibdrv_DescribePixelFormat( PHYSDEV dev, int fmt, UINT size, PIXELFORMATDESCRIPTOR *descr )
int dibdrv_wglDescribePixelFormat( HDC hdc, int fmt, UINT size, PIXELFORMATDESCRIPTOR *descr )
{
int ret = sizeof(pixel_formats) / sizeof(pixel_formats[0]);
@ -170,22 +172,6 @@ int dibdrv_DescribePixelFormat( PHYSDEV dev, int fmt, UINT size, PIXELFORMATDESC
return ret;
}
/**********************************************************************
* dibdrv_SetPixelFormat
*/
BOOL dibdrv_SetPixelFormat( PHYSDEV dev, int fmt, const PIXELFORMATDESCRIPTOR *descr )
{
DC *dc;
BOOL ret = TRUE;
if (fmt <= 0 || fmt > nb_formats) return FALSE;
dc = get_dc_ptr( dev->hdc );
if (!dc->pixel_format) dc->pixel_format = fmt;
else ret = (dc->pixel_format == fmt);
release_dc_ptr( dc );
return ret;
}
/***********************************************************************
* dibdrv_wglCopyContext
*/
@ -300,6 +286,15 @@ static BOOL dibdrv_wglMakeCurrent( HDC hdc, struct wgl_context *context )
return ret;
}
/**********************************************************************
* dibdrv_wglSetPixelFormat
*/
BOOL dibdrv_wglSetPixelFormat( HDC hdc, int fmt, const PIXELFORMATDESCRIPTOR *descr )
{
if (fmt <= 0 || fmt > nb_formats) return FALSE;
return GdiSetPixelFormat( hdc, fmt, descr );
}
/***********************************************************************
* dibdrv_wglShareLists
*/
@ -315,9 +310,11 @@ static struct opengl_funcs opengl_funcs =
dibdrv_wglCopyContext, /* p_wglCopyContext */
dibdrv_wglCreateContext, /* p_wglCreateContext */
dibdrv_wglDeleteContext, /* p_wglDeleteContext */
dibdrv_wglDescribePixelFormat,/* p_wglDescribePixelFormat */
dibdrv_wglGetPixelFormat, /* p_wglGetPixelFormat */
dibdrv_wglGetProcAddress, /* p_wglGetProcAddress */
dibdrv_wglMakeCurrent, /* p_wglMakeCurrent */
dibdrv_wglSetPixelFormat, /* p_wglSetPixelFormat */
dibdrv_wglShareLists, /* p_wglShareLists */
}
};
@ -340,28 +337,13 @@ struct opengl_funcs *dibdrv_wine_get_wgl_driver( PHYSDEV dev, UINT version )
#else /* SONAME_LIBOSMESA */
/**********************************************************************
* dibdrv_DescribePixelFormat
*/
int dibdrv_DescribePixelFormat( PHYSDEV dev, int fmt, UINT size, PIXELFORMATDESCRIPTOR *descr )
{
return 0;
}
/**********************************************************************
* dibdrv_SetPixelFormat
*/
BOOL dibdrv_SetPixelFormat( PHYSDEV dev, int fmt, const PIXELFORMATDESCRIPTOR *descr )
{
return FALSE;
}
/**********************************************************************
* dibdrv_wine_get_wgl_driver
*/
struct opengl_funcs *dibdrv_wine_get_wgl_driver( PHYSDEV dev, UINT version )
{
ERR( "OSMesa not compiled in, no OpenGL bitmap support\n" );
static int warned;
if (!warned++) ERR( "OSMesa not compiled in, no OpenGL bitmap support\n" );
return (void *)-1;
}

View File

@ -228,11 +228,6 @@ static BOOL nulldrv_DeleteObject( PHYSDEV dev, HGDIOBJ obj )
return TRUE;
}
static INT nulldrv_DescribePixelFormat( PHYSDEV dev, INT format, UINT size, PIXELFORMATDESCRIPTOR * descr )
{
return 0;
}
static DWORD nulldrv_DeviceCapabilities( LPSTR buffer, LPCSTR device, LPCSTR port,
WORD cap, LPSTR output, DEVMODEA *devmode )
{
@ -595,11 +590,6 @@ static COLORREF nulldrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
return color;
}
static BOOL nulldrv_SetPixelFormat( PHYSDEV dev, INT format, const PIXELFORMATDESCRIPTOR *descr )
{
return FALSE;
}
static INT nulldrv_SetPolyFillMode( PHYSDEV dev, INT mode )
{
return mode;
@ -681,7 +671,6 @@ const struct gdi_dc_funcs null_driver =
nulldrv_CreateDC, /* pCreateDC */
nulldrv_DeleteDC, /* pDeleteDC */
nulldrv_DeleteObject, /* pDeleteObject */
nulldrv_DescribePixelFormat, /* pDescribePixelFormat */
nulldrv_DeviceCapabilities, /* pDeviceCapabilities */
nulldrv_Ellipse, /* pEllipse */
nulldrv_EndDoc, /* pEndDoc */
@ -773,7 +762,6 @@ const struct gdi_dc_funcs null_driver =
nulldrv_SetMapMode, /* pSetMapMode */
nulldrv_SetMapperFlags, /* pSetMapperFlags */
nulldrv_SetPixel, /* pSetPixel */
nulldrv_SetPixelFormat, /* pSetPixelFormat */
nulldrv_SetPolyFillMode, /* pSetPolyFillMode */
nulldrv_SetROP2, /* pSetROP2 */
nulldrv_SetRelAbs, /* pSetRelAbs */

View File

@ -50,7 +50,6 @@ static const struct gdi_dc_funcs EMFDRV_Funcs =
NULL, /* pCreateDC */
EMFDRV_DeleteDC, /* pDeleteDC */
EMFDRV_DeleteObject, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
EMFDRV_Ellipse, /* pEllipse */
NULL, /* pEndDoc */
@ -142,7 +141,6 @@ static const struct gdi_dc_funcs EMFDRV_Funcs =
EMFDRV_SetMapMode, /* pSetMapMode */
EMFDRV_SetMapperFlags, /* pSetMapperFlags */
EMFDRV_SetPixel, /* pSetPixel */
NULL, /* pSetPixelFormat */
EMFDRV_SetPolyFillMode, /* pSetPolyFillMode */
EMFDRV_SetROP2, /* pSetROP2 */
NULL, /* pSetRelAbs */

View File

@ -7754,7 +7754,6 @@ static const struct gdi_dc_funcs freetype_funcs =
freetype_CreateDC, /* pCreateDC */
freetype_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
NULL, /* pEllipse */
NULL, /* pEndDoc */
@ -7846,7 +7845,6 @@ static const struct gdi_dc_funcs freetype_funcs =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
NULL, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */

View File

@ -113,7 +113,6 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pCreateDC */
MFDRV_DeleteDC, /* pDeleteDC */
MFDRV_DeleteObject, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
MFDRV_Ellipse, /* pEllipse */
NULL, /* pEndDoc */
@ -205,7 +204,6 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
MFDRV_SetMapMode, /* pSetMapMode */
MFDRV_SetMapperFlags, /* pSetMapperFlags */
MFDRV_SetPixel, /* pSetPixel */
NULL, /* pSetPixelFormat */
MFDRV_SetPolyFillMode, /* pSetPolyFillMode */
MFDRV_SetROP2, /* pSetROP2 */
MFDRV_SetRelAbs, /* pSetRelAbs */

View File

@ -490,21 +490,19 @@ COLORREF WINAPI GetPixel( HDC hdc, INT x, INT y )
*
* Probably not the correct semantics, it's supposed to be an internal backend for SetPixelFormat.
*/
BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd)
BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT format, const PIXELFORMATDESCRIPTOR *descr )
{
INT bRet = FALSE;
DC * dc = get_dc_ptr( hdc );
DC *dc;
BOOL ret = TRUE;
TRACE("(%p,%d,%p)\n",hdc,iPixelFormat,ppfd);
TRACE("(%p,%d,%p)\n", hdc, format, descr);
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetPixelFormat );
update_dc( dc );
bRet = physdev->funcs->pSetPixelFormat( physdev, iPixelFormat, ppfd );
if (!(dc = get_dc_ptr( hdc ))) return FALSE;
if (!dc->pixel_format) dc->pixel_format = format;
else ret = (dc->pixel_format == format);
release_dc_ptr( dc );
}
return bRet;
return ret;
}
@ -513,22 +511,10 @@ BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT iPixelFormat, const PIXELFORMATDESCR
*
* Probably not the correct semantics, it's supposed to be an internal backend for DescribePixelFormat.
*/
INT WINAPI GdiDescribePixelFormat( HDC hdc, INT iPixelFormat, UINT nBytes,
LPPIXELFORMATDESCRIPTOR ppfd )
INT WINAPI GdiDescribePixelFormat( HDC hdc, INT format, UINT size, PIXELFORMATDESCRIPTOR *descr )
{
INT ret = 0;
DC * dc = get_dc_ptr( hdc );
TRACE("(%p,%d,%d,%p): stub\n",hdc,iPixelFormat,nBytes,ppfd);
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pDescribePixelFormat );
update_dc( dc );
ret = physdev->funcs->pDescribePixelFormat( physdev, iPixelFormat, nBytes, ppfd );
release_dc_ptr( dc );
}
return ret;
FIXME( "(%p,%d,%d,%p): stub\n", hdc, format, size, descr );
return 0;
}

View File

@ -2247,7 +2247,6 @@ const struct gdi_dc_funcs path_driver =
pathdrv_CreateDC, /* pCreateDC */
pathdrv_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
pathdrv_Ellipse, /* pEllipse */
NULL, /* pEndDoc */
@ -2339,7 +2338,6 @@ const struct gdi_dc_funcs path_driver =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
NULL, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */

View File

@ -622,10 +622,17 @@ my %wgl_functions =
[ "UINT", "mask" ] ] ],
"wglCreateContext" => [ "struct wgl_context *", [ [ "HDC", "hdc" ] ] ],
"wglDeleteContext" => [ "void", [ [ "struct wgl_context *", "context" ] ] ],
"wglDescribePixelFormat" => [ "INT", [ [ "HDC", "hdc" ],
[ "INT", "format" ],
[ "UINT", "size" ],
[ "PIXELFORMATDESCRIPTOR *", "descr" ] ] ],
"wglGetPixelFormat" => [ "INT", [ [ "HDC", "hdc" ] ] ],
"wglGetProcAddress" => [ "PROC", [ [ "LPCSTR", "name" ] ] ],
"wglMakeCurrent" => [ "BOOL", [ [ "HDC", "hdc" ],
[ "struct wgl_context *", "context" ] ] ],
"wglSetPixelFormat" => [ "BOOL", [ [ "HDC", "hdc" ],
[ "INT", "format" ],
[ "const PIXELFORMATDESCRIPTOR *", "descr" ] ] ],
"wglShareLists" => [ "BOOL", [ [ "struct wgl_context *", "org" ],
[ "struct wgl_context *", "dst" ] ] ],
);
@ -874,6 +881,7 @@ print NORM "
#include <stdarg.h>
#include \"opengl_ext.h\"
#include \"winternl.h\"
#include \"wingdi.h\"
#include \"wine/wgl_driver.h\"
#include \"wine/debug.h\"
@ -913,6 +921,7 @@ print EXT "
#include <stdarg.h>
#include \"opengl_ext.h\"
#include \"winternl.h\"
#include \"wingdi.h\"
#define WGL_WGLEXT_PROTOTYPES
#include \"wine/wglext.h\"
#include \"wine/wgl_driver.h\"

View File

@ -5,6 +5,7 @@
#include <stdarg.h>
#include "opengl_ext.h"
#include "winternl.h"
#include "wingdi.h"
#define WGL_WGLEXT_PROTOTYPES
#include "wine/wglext.h"
#include "wine/wgl_driver.h"

View File

@ -5,6 +5,7 @@
#include <stdarg.h>
#include "opengl_ext.h"
#include "winternl.h"
#include "wingdi.h"
#include "wine/wgl_driver.h"
#include "wine/debug.h"
@ -3027,9 +3028,11 @@ void WINAPI wine_glViewport( GLint x, GLint y, GLsizei width, GLsizei height ) {
static BOOL null_wglCopyContext( struct wgl_context * src, struct wgl_context * dst, UINT mask ) { return 0; }
static struct wgl_context * null_wglCreateContext( HDC hdc ) { return 0; }
static void null_wglDeleteContext( struct wgl_context * context ) { }
static INT null_wglDescribePixelFormat( HDC hdc, INT format, UINT size, PIXELFORMATDESCRIPTOR * descr ) { return 0; }
static INT null_wglGetPixelFormat( HDC hdc ) { return 0; }
static PROC null_wglGetProcAddress( LPCSTR name ) { return 0; }
static BOOL null_wglMakeCurrent( HDC hdc, struct wgl_context * context ) { return 0; }
static BOOL null_wglSetPixelFormat( HDC hdc, INT format, const PIXELFORMATDESCRIPTOR * descr ) { return 0; }
static BOOL null_wglShareLists( struct wgl_context * org, struct wgl_context * dst ) { return 0; }
static void null_glAccum( GLenum op, GLfloat value ) { }
static void null_glAlphaFunc( GLenum func, GLfloat ref ) { }
@ -3374,9 +3377,11 @@ struct opengl_funcs null_opengl_funcs =
null_wglCopyContext,
null_wglCreateContext,
null_wglDeleteContext,
null_wglDescribePixelFormat,
null_wglGetPixelFormat,
null_wglGetProcAddress,
null_wglMakeCurrent,
null_wglSetPixelFormat,
null_wglShareLists,
},
#define USE_GL_FUNC(name) null_##name,

View File

@ -50,8 +50,6 @@ extern struct opengl_funcs null_opengl_funcs;
const GLubyte * WINAPI wine_glGetString( GLenum name );
/* internal GDI functions */
extern INT WINAPI GdiDescribePixelFormat( HDC hdc, INT fmt, UINT size, PIXELFORMATDESCRIPTOR *pfd );
extern BOOL WINAPI GdiSetPixelFormat( HDC hdc, INT fmt, const PIXELFORMATDESCRIPTOR *pfd );
extern BOOL WINAPI GdiSwapBuffers( HDC hdc );
/* handle management */
@ -170,15 +168,6 @@ static void free_handle_ptr( struct wgl_handle *ptr )
LeaveCriticalSection( &wgl_section );
}
/***********************************************************************
* wglSetPixelFormat(OPENGL32.@)
*/
BOOL WINAPI wglSetPixelFormat( HDC hdc, INT iPixelFormat,
const PIXELFORMATDESCRIPTOR *ppfd)
{
return GdiSetPixelFormat(hdc, iPixelFormat, ppfd);
}
/***********************************************************************
* wglCopyContext (OPENGL32.@)
*/
@ -417,6 +406,16 @@ HGLRC WINAPI wglGetCurrentContext(void)
return NtCurrentTeb()->glCurrentRC;
}
/***********************************************************************
* wglDescribePixelFormat (OPENGL32.@)
*/
INT WINAPI wglDescribePixelFormat(HDC hdc, INT format, UINT size, PIXELFORMATDESCRIPTOR *descr )
{
struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs) return 0;
return funcs->wgl.p_wglDescribePixelFormat( hdc, format, size, descr );
}
/***********************************************************************
* wglChoosePixelFormat (OPENGL32.@)
*/
@ -432,7 +431,7 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
ppfd->cColorBits, ppfd->cRedBits, ppfd->cGreenBits, ppfd->cBlueBits, ppfd->cAlphaBits,
ppfd->cAccumBits, ppfd->cDepthBits, ppfd->cStencilBits, ppfd->cAuxBuffers );
count = GdiDescribePixelFormat( hdc, 0, 0, NULL );
count = wglDescribePixelFormat( hdc, 0, 0, NULL );
if (!count) return 0;
best_format = 0;
@ -445,7 +444,7 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
for (i = 1; i <= count; i++)
{
if (!GdiDescribePixelFormat( hdc, i, sizeof(format), &format )) continue;
if (!wglDescribePixelFormat( hdc, i, sizeof(format), &format )) continue;
if (ppfd->iPixelType != format.iPixelType)
{
@ -580,15 +579,6 @@ INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
return best_format;
}
/***********************************************************************
* wglDescribePixelFormat (OPENGL32.@)
*/
INT WINAPI wglDescribePixelFormat(HDC hdc, INT iPixelFormat, UINT nBytes,
LPPIXELFORMATDESCRIPTOR ppfd)
{
return GdiDescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd);
}
/***********************************************************************
* wglGetPixelFormat (OPENGL32.@)
*/
@ -599,6 +589,16 @@ INT WINAPI wglGetPixelFormat(HDC hdc)
return funcs->wgl.p_wglGetPixelFormat( hdc );
}
/***********************************************************************
* wglSetPixelFormat(OPENGL32.@)
*/
BOOL WINAPI wglSetPixelFormat( HDC hdc, INT format, const PIXELFORMATDESCRIPTOR *descr )
{
struct opengl_funcs *funcs = get_dc_funcs( hdc );
if (!funcs) return 0;
return funcs->wgl.p_wglSetPixelFormat( hdc, format, descr );
}
/***********************************************************************
* wglCreateLayerContext (OPENGL32.@)
*/

View File

@ -724,7 +724,6 @@ static const struct gdi_dc_funcs psdrv_funcs =
PSDRV_CreateDC, /* pCreateDC */
PSDRV_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
PSDRV_DeviceCapabilities, /* pDeviceCapabilities */
PSDRV_Ellipse, /* pEllipse */
PSDRV_EndDoc, /* pEndDoc */
@ -816,7 +815,6 @@ static const struct gdi_dc_funcs psdrv_funcs =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
PSDRV_SetPixel, /* pSetPixel */
NULL, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */

View File

@ -436,31 +436,6 @@ static INT X11DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_d
}
static inline void opengl_error(void)
{
static int warned;
if (!warned++) ERR("No OpenGL support compiled in.\n");
}
/***********************************************************************
* X11DRV_DescribePixelFormat
*/
static int X11DRV_DescribePixelFormat( PHYSDEV dev, int fmt, UINT size, PIXELFORMATDESCRIPTOR *ppfd )
{
opengl_error();
return 0;
}
/***********************************************************************
* X11DRV_SetPixelFormat
*/
static BOOL X11DRV_SetPixelFormat( PHYSDEV dev, int fmt, const PIXELFORMATDESCRIPTOR *ppfd )
{
opengl_error();
return FALSE;
}
static const struct gdi_dc_funcs x11drv_funcs =
{
NULL, /* pAbortDoc */
@ -477,7 +452,6 @@ static const struct gdi_dc_funcs x11drv_funcs =
X11DRV_CreateDC, /* pCreateDC */
X11DRV_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
X11DRV_DescribePixelFormat, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
X11DRV_Ellipse, /* pEllipse */
NULL, /* pEndDoc */
@ -569,7 +543,6 @@ static const struct gdi_dc_funcs x11drv_funcs =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
X11DRV_SetPixel, /* pSetPixel */
X11DRV_SetPixelFormat, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */

View File

@ -1161,7 +1161,7 @@ Drawable create_glxpixmap(Display *display, XVisualInfo *vis, Pixmap parent)
*
* Get the pixel-format descriptor associated to the given id
*/
static int glxdrv_DescribePixelFormat(PHYSDEV dev, int iPixelFormat,
static int glxdrv_wglDescribePixelFormat( HDC hdc, int iPixelFormat,
UINT nBytes, PIXELFORMATDESCRIPTOR *ppfd)
{
/*XVisualInfo *vis;*/
@ -1173,7 +1173,7 @@ static int glxdrv_DescribePixelFormat(PHYSDEV dev, int iPixelFormat,
if (!has_opengl()) return 0;
TRACE("(%p,%d,%d,%p)\n", dev->hdc, iPixelFormat, nBytes, ppfd);
TRACE("(%p,%d,%d,%p)\n", hdc, iPixelFormat, nBytes, ppfd);
/* Look for the iPixelFormat in our list of supported formats. If it is supported we get the index in the FBConfig table and the number of supported formats back */
fmt = ConvertPixelFormatWGLtoGLX(gdi_display, iPixelFormat, FALSE /* Offscreen */, &fmt_count);
@ -1335,24 +1335,27 @@ static int glxdrv_wglGetPixelFormat( HDC hdc )
}
/***********************************************************************
* glxdrv_SetPixelFormat
* glxdrv_wglSetPixelFormat
*/
static BOOL glxdrv_SetPixelFormat(PHYSDEV dev, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd)
static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd )
{
struct glx_physdev *physdev = get_glxdrv_dev( dev );
struct x11drv_escape_get_drawable escape;
WineGLPixelFormat *fmt;
int value;
HWND hwnd;
TRACE("(%p,%d,%p)\n", dev->hdc, iPixelFormat, ppfd);
TRACE("(%p,%d,%p)\n", hdc, iPixelFormat, ppfd);
if (!has_opengl()) return FALSE;
escape.code = X11DRV_GET_DRAWABLE;
if (!ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape.code), (LPCSTR)&escape.code,
sizeof(escape), (LPSTR)&escape ))
return 0;
if(physdev->pixel_format) /* cannot change it if already set */
return (physdev->pixel_format == iPixelFormat);
if (escape.pixel_format) /* cannot change it if already set */
return (escape.pixel_format == iPixelFormat);
/* SetPixelFormat is not allowed on the X root_window e.g. GetDC(0) */
if(physdev->x11dev->drawable == root_window)
if (escape.drawable == root_window)
{
ERR("Invalid operation on root_window\n");
return FALSE;
@ -1369,7 +1372,7 @@ static BOOL glxdrv_SetPixelFormat(PHYSDEV dev, int iPixelFormat, const PIXELFORM
pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &value);
wine_tsx11_unlock();
hwnd = WindowFromDC(physdev->dev.hdc);
hwnd = WindowFromDC( hdc );
if(hwnd) {
if(!(value&GLX_WINDOW_BIT)) {
WARN("Pixel format %d is not compatible for window rendering\n", iPixelFormat);
@ -3116,7 +3119,6 @@ static const struct gdi_dc_funcs glxdrv_funcs =
glxdrv_CreateDC, /* pCreateDC */
glxdrv_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
glxdrv_DescribePixelFormat, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
NULL, /* pEllipse */
NULL, /* pEndDoc */
@ -3208,7 +3210,6 @@ static const struct gdi_dc_funcs glxdrv_funcs =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
glxdrv_SetPixelFormat, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */
@ -3241,9 +3242,11 @@ static struct opengl_funcs opengl_funcs =
glxdrv_wglCopyContext, /* p_wglCopyContext */
glxdrv_wglCreateContext, /* p_wglCreateContext */
glxdrv_wglDeleteContext, /* p_wglDeleteContext */
glxdrv_wglDescribePixelFormat, /* p_wglDescribePixelFormat */
glxdrv_wglGetPixelFormat, /* p_wglGetPixelFormat */
glxdrv_wglGetProcAddress, /* p_wglGetProcAddress */
glxdrv_wglMakeCurrent, /* p_wglMakeCurrent */
glxdrv_wglSetPixelFormat, /* p_wglSetPixelFormat */
glxdrv_wglShareLists, /* p_wglShareLists */
}
};

View File

@ -2480,7 +2480,6 @@ static const struct gdi_dc_funcs xrender_funcs =
xrenderdrv_CreateDC, /* pCreateDC */
xrenderdrv_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
NULL, /* pEllipse */
NULL, /* pEndDoc */
@ -2572,7 +2571,6 @@ static const struct gdi_dc_funcs xrender_funcs =
NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */
NULL, /* pSetPixelFormat */
NULL, /* pSetPolyFillMode */
NULL, /* pSetROP2 */
NULL, /* pSetRelAbs */

View File

@ -76,7 +76,6 @@ struct gdi_dc_funcs
BOOL (*pCreateDC)(PHYSDEV*,LPCWSTR,LPCWSTR,LPCWSTR,const DEVMODEW*);
BOOL (*pDeleteDC)(PHYSDEV);
BOOL (*pDeleteObject)(PHYSDEV,HGDIOBJ);
INT (*pDescribePixelFormat)(PHYSDEV,INT,UINT,PIXELFORMATDESCRIPTOR *);
DWORD (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
BOOL (*pEllipse)(PHYSDEV,INT,INT,INT,INT);
INT (*pEndDoc)(PHYSDEV);
@ -168,7 +167,6 @@ struct gdi_dc_funcs
INT (*pSetMapMode)(PHYSDEV,INT);
DWORD (*pSetMapperFlags)(PHYSDEV,DWORD);
COLORREF (*pSetPixel)(PHYSDEV,INT,INT,COLORREF);
BOOL (*pSetPixelFormat)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
INT (*pSetPolyFillMode)(PHYSDEV,INT);
INT (*pSetROP2)(PHYSDEV,INT);
INT (*pSetRelAbs)(PHYSDEV,INT);
@ -198,7 +196,7 @@ struct gdi_dc_funcs
};
/* increment this when you change the DC function table */
#define WINE_GDI_DRIVER_VERSION 42
#define WINE_GDI_DRIVER_VERSION 43
#define GDI_PRIORITY_NULL_DRV 0 /* null driver */
#define GDI_PRIORITY_FONT_DRV 100 /* any font driver */

View File

@ -7,7 +7,7 @@
#define WINE_GLAPI
#endif
#define WINE_WGL_DRIVER_VERSION 5
#define WINE_WGL_DRIVER_VERSION 6
struct wgl_context;
struct wgl_pbuffer;
@ -19,9 +19,11 @@ struct opengl_funcs
BOOL (WINE_GLAPI *p_wglCopyContext)(struct wgl_context *,struct wgl_context *,UINT);
struct wgl_context * (WINE_GLAPI *p_wglCreateContext)(HDC);
void (WINE_GLAPI *p_wglDeleteContext)(struct wgl_context *);
INT (WINE_GLAPI *p_wglDescribePixelFormat)(HDC,INT,UINT,PIXELFORMATDESCRIPTOR *);
INT (WINE_GLAPI *p_wglGetPixelFormat)(HDC);
PROC (WINE_GLAPI *p_wglGetProcAddress)(LPCSTR);
BOOL (WINE_GLAPI *p_wglMakeCurrent)(HDC,struct wgl_context *);
BOOL (WINE_GLAPI *p_wglSetPixelFormat)(HDC,INT,const PIXELFORMATDESCRIPTOR *);
BOOL (WINE_GLAPI *p_wglShareLists)(struct wgl_context *,struct wgl_context *);
} wgl;