From 147174ff1ca864a3d275d12290aac4c427b5140d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 8 May 2012 12:35:13 +0200 Subject: [PATCH] winex11: Implement wglGetPbufferDCARB with a DC escape and remove it from the GDI driver interface. --- dlls/gdi32/dibdrv/dc.c | 10 ---------- dlls/gdi32/driver.c | 6 ------ dlls/gdi32/enhmfdrv/init.c | 1 - dlls/gdi32/freetype.c | 1 - dlls/gdi32/mfdrv/init.c | 1 - dlls/gdi32/opengl.c | 30 ------------------------------ dlls/gdi32/path.c | 1 - dlls/wineps.drv/init.c | 1 - dlls/winex11.drv/init.c | 10 ---------- dlls/winex11.drv/opengl.c | 38 ++++++++++++++++++++------------------ dlls/winex11.drv/xrender.c | 1 - include/wine/gdi_driver.h | 3 +-- 12 files changed, 21 insertions(+), 82 deletions(-) diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c index 8f823fc9e39..6d4fa871812 100644 --- a/dlls/gdi32/dibdrv/dc.c +++ b/dlls/gdi32/dibdrv/dc.c @@ -523,15 +523,6 @@ static BOOL dibdrv_wglDeleteContext( HGLRC ctx ) } /*********************************************************************** - * dibdrv_wglGetPbufferDCARB - */ -static HDC dibdrv_wglGetPbufferDCARB( PHYSDEV dev, void *buffer ) -{ - FIXME( "Not supported on DIB section\n" ); - return 0; -} - -/*********************************************************************** * dibdrv_wglGetProcAddress */ static PROC dibdrv_wglGetProcAddress( LPCSTR name ) @@ -734,7 +725,6 @@ const struct gdi_dc_funcs dib_driver = dibdrv_wglCreateContext, /* pwglCreateContext */ dibdrv_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */ dibdrv_wglDeleteContext, /* pwglDeleteContext */ - dibdrv_wglGetPbufferDCARB, /* pwglGetPbufferDCARB */ dibdrv_wglGetProcAddress, /* pwglGetProcAddress */ dibdrv_wglMakeContextCurrentARB, /* pwglMakeContextCurrentARB */ dibdrv_wglMakeCurrent, /* pwglMakeCurrent */ diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c index 94fbec36fa8..0d84761c07e 100644 --- a/dlls/gdi32/driver.c +++ b/dlls/gdi32/driver.c @@ -692,11 +692,6 @@ static PROC nulldrv_wglGetProcAddress( LPCSTR name ) return NULL; } -static HDC nulldrv_wglGetPbufferDCARB( PHYSDEV dev, void *pbuffer ) -{ - return 0; -} - static BOOL nulldrv_wglMakeCurrent( PHYSDEV dev, HGLRC ctx ) { return FALSE; @@ -867,7 +862,6 @@ const struct gdi_dc_funcs null_driver = nulldrv_wglCreateContext, /* pwglCreateContext */ nulldrv_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */ nulldrv_wglDeleteContext, /* pwglDeleteContext */ - nulldrv_wglGetPbufferDCARB, /* pwglGetPbufferDCARB */ nulldrv_wglGetProcAddress, /* pwglGetProcAddress */ nulldrv_wglMakeContextCurrentARB, /* pwglMakeContextCurrentARB */ nulldrv_wglMakeCurrent, /* pwglMakeCurrent */ diff --git a/dlls/gdi32/enhmfdrv/init.c b/dlls/gdi32/enhmfdrv/init.c index 0caf87e196c..6dd73ebbde5 100644 --- a/dlls/gdi32/enhmfdrv/init.c +++ b/dlls/gdi32/enhmfdrv/init.c @@ -174,7 +174,6 @@ static const struct gdi_dc_funcs EMFDRV_Funcs = NULL, /* pwglCreateContext */ NULL, /* pwglCreateContextAttribsARB */ NULL, /* pwglDeleteContext */ - NULL, /* pwglGetPbufferDCARB */ NULL, /* pwglGetProcAddress */ NULL, /* pwglMakeContextCurrentARB */ NULL, /* pwglMakeCurrent */ diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index f5868acee51..80e5cbd1f01 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -7878,7 +7878,6 @@ static const struct gdi_dc_funcs freetype_funcs = NULL, /* pwglCreateContext */ NULL, /* pwglCreateContextAttribsARB */ NULL, /* pwglDeleteContext */ - NULL, /* pwglGetPbufferDCARB */ NULL, /* pwglGetProcAddress */ NULL, /* pwglMakeContextCurrentARB */ NULL, /* pwglMakeCurrent */ diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index a428d2a4e79..1c4b2fa8c78 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -237,7 +237,6 @@ static const struct gdi_dc_funcs MFDRV_Funcs = NULL, /* pwglCreateContext */ NULL, /* pwglCreateContextAttribsARB */ NULL, /* pwglDeleteContext */ - NULL, /* pwglGetPbufferDCARB */ NULL, /* pwglGetProcAddress */ NULL, /* pwglMakeContextCurrentARB */ NULL, /* pwglMakeCurrent */ diff --git a/dlls/gdi32/opengl.c b/dlls/gdi32/opengl.c index 2df45c47fb8..16889f20305 100644 --- a/dlls/gdi32/opengl.c +++ b/dlls/gdi32/opengl.c @@ -179,34 +179,6 @@ HDC WINAPI wglGetCurrentDC(void) } /*********************************************************************** - * wglGetPbufferDCARB - */ -static HDC WINAPI wglGetPbufferDCARB(void *pbuffer) -{ - HDC ret = 0; - - /* Create a device context to associate with the pbuffer */ - HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL); - DC *dc = get_dc_ptr(hdc); - - TRACE("(%p)\n", pbuffer); - - if (dc) - { - PHYSDEV physdev = GET_DC_PHYSDEV( dc, pwglGetPbufferDCARB ); - - /* The display driver has to do the rest of the work because - * we need access to lowlevel datatypes which we can't access here - */ - ret = physdev->funcs->pwglGetPbufferDCARB( physdev, pbuffer ); - release_dc_ptr( dc ); - } - TRACE("(%p), hdc=%p\n", pbuffer, ret); - if (!ret) DeleteDC( hdc ); - return ret; -} - -/*********************************************************************** * wglMakeCurrent (OPENGL32.@) */ BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc) @@ -388,8 +360,6 @@ PROC WINAPI wglGetProcAddress(LPCSTR func) return (PROC)wglCreateContextAttribsARB; else if(ret && strcmp(func, "wglMakeContextCurrentARB") == 0) return (PROC)wglMakeContextCurrentARB; - else if(ret && strcmp(func, "wglGetPbufferDCARB") == 0) - return (PROC)wglGetPbufferDCARB; else if(ret && strcmp(func, "wglSetPixelFormatWINE") == 0) return (PROC)wglSetPixelFormatWINE; diff --git a/dlls/gdi32/path.c b/dlls/gdi32/path.c index af2f7e671d8..57b486c1cc9 100644 --- a/dlls/gdi32/path.c +++ b/dlls/gdi32/path.c @@ -2371,7 +2371,6 @@ const struct gdi_dc_funcs path_driver = NULL, /* pwglCreateContext */ NULL, /* pwglCreateContextAttribsARB */ NULL, /* pwglDeleteContext */ - NULL, /* pwglGetPbufferDCARB */ NULL, /* pwglGetProcAddress */ NULL, /* pwglMakeContextCurrentARB */ NULL, /* pwglMakeCurrent */ diff --git a/dlls/wineps.drv/init.c b/dlls/wineps.drv/init.c index abb6bf01d8f..e27c76cf862 100644 --- a/dlls/wineps.drv/init.c +++ b/dlls/wineps.drv/init.c @@ -956,7 +956,6 @@ static const struct gdi_dc_funcs psdrv_funcs = NULL, /* pwglCreateContext */ NULL, /* pwglCreateContextAttribsARB */ NULL, /* pwglDeleteContext */ - NULL, /* pwglGetPbufferDCARB */ NULL, /* pwglGetProcAddress */ NULL, /* pwglMakeContextCurrentARB */ NULL, /* pwglMakeCurrent */ diff --git a/dlls/winex11.drv/init.c b/dlls/winex11.drv/init.c index 26baea59e97..2dd6c4b690d 100644 --- a/dlls/winex11.drv/init.c +++ b/dlls/winex11.drv/init.c @@ -500,15 +500,6 @@ static PROC X11DRV_wglGetProcAddress( LPCSTR proc ) } /*********************************************************************** - * X11DRV_wglGetPbufferDCARB - */ -static HDC X11DRV_wglGetPbufferDCARB( PHYSDEV dev, void *hPbuffer ) -{ - opengl_error(); - return NULL; -} - -/*********************************************************************** * X11DRV_wglSetPixelFormatWINE */ static BOOL X11DRV_wglSetPixelFormatWINE( PHYSDEV dev, int fmt, const PIXELFORMATDESCRIPTOR *ppfd ) @@ -658,7 +649,6 @@ static const struct gdi_dc_funcs x11drv_funcs = X11DRV_wglCreateContext, /* pwglCreateContext */ X11DRV_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */ NULL, /* pwglDeleteContext */ - X11DRV_wglGetPbufferDCARB, /* pwglGetPbufferDCARB */ X11DRV_wglGetProcAddress, /* pwglGetProcAddress */ NULL, /* pwglMakeContextCurrentARB */ NULL, /* pwglMakeCurrent */ diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index b9d101e51ab..0239916d544 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2589,34 +2589,37 @@ static GLboolean WINAPI X11DRV_wglDestroyPbufferARB(HPBUFFERARB hPbuffer) } /** - * glxdrv_wglGetPbufferDCARB + * X11DRV_wglGetPbufferDCARB * * WGL_ARB_pbuffer: wglGetPbufferDCARB - * The function wglGetPbufferDCARB returns a device context for a pbuffer. - * Gdi32 implements the part of this function which creates a device context. - * This part associates the physDev with the X drawable of the pbuffer. */ -static HDC glxdrv_wglGetPbufferDCARB(PHYSDEV dev, HPBUFFERARB hPbuffer) +static HDC WINAPI X11DRV_wglGetPbufferDCARB(HPBUFFERARB hPbuffer) { - X11DRV_PDEVICE *physDev = get_glxdrv_dev( dev )->x11dev; + struct x11drv_escape_set_drawable escape; Wine_GLPBuffer* object = hPbuffer; + HDC hdc; if (NULL == object) { SetLastError(ERROR_INVALID_HANDLE); return NULL; } - /* The function wglGetPbufferDCARB returns a DC to which the pbuffer can be connected. - * All formats in our pixelformat list are compatible with each other and the main drawable. */ - physDev->current_pf = object->fmt->iPixelFormat; - physDev->drawable = object->drawable; - physDev->gl_drawable = object->drawable; - physDev->gl_type = DC_GL_PBUFFER; - SetRect( &physDev->drawable_rect, 0, 0, object->width, object->height ); - physDev->dc_rect = physDev->drawable_rect; + hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL ); + if (!hdc) return 0; + + escape.code = X11DRV_SET_DRAWABLE; + escape.drawable = object->drawable; + escape.mode = IncludeInferiors; + SetRect( &escape.drawable_rect, 0, 0, object->width, object->height ); + escape.dc_rect = escape.drawable_rect; + escape.fbconfig_id = object->fmt->fmt_id; + escape.gl_drawable = object->drawable; + escape.pixmap = 0; + escape.gl_type = DC_GL_PBUFFER; + ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL ); - TRACE("(%p)->(%p)\n", hPbuffer, dev->hdc); - return dev->hdc; + TRACE( "(%p)->(%p)\n", hPbuffer, hdc ); + return hdc; } /** @@ -3552,7 +3555,7 @@ static const WineGLExtension WGL_ARB_pbuffer = { { "wglCreatePbufferARB", X11DRV_wglCreatePbufferARB }, { "wglDestroyPbufferARB", X11DRV_wglDestroyPbufferARB }, - { "wglGetPbufferDCARB", (void *)1 /* not called directly */ }, + { "wglGetPbufferDCARB", X11DRV_wglGetPbufferDCARB }, { "wglQueryPbufferARB", X11DRV_wglQueryPbufferARB }, { "wglReleasePbufferDCARB", X11DRV_wglReleasePbufferDCARB }, { "wglSetPbufferAttribARB", X11DRV_wglSetPbufferAttribARB }, @@ -3992,7 +3995,6 @@ static const struct gdi_dc_funcs glxdrv_funcs = glxdrv_wglCreateContext, /* pwglCreateContext */ glxdrv_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */ glxdrv_wglDeleteContext, /* pwglDeleteContext */ - glxdrv_wglGetPbufferDCARB, /* pwglGetPbufferDCARB */ glxdrv_wglGetProcAddress, /* pwglGetProcAddress */ glxdrv_wglMakeContextCurrentARB, /* pwglMakeContextCurrentARB */ glxdrv_wglMakeCurrent, /* pwglMakeCurrent */ diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 813a9273d1e..ffd1b4d95d6 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -2784,7 +2784,6 @@ static const struct gdi_dc_funcs xrender_funcs = NULL, /* pwglCreateContext */ NULL, /* pwglCreateContextAttribsARB */ NULL, /* pwglDeleteContext */ - NULL, /* pwglGetPbufferDCARB */ NULL, /* pwglGetProcAddress */ NULL, /* pwglMakeContextCurrentARB */ NULL, /* pwglMakeCurrent */ diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h index 35e462300c4..47c45aeb82d 100644 --- a/include/wine/gdi_driver.h +++ b/include/wine/gdi_driver.h @@ -200,7 +200,6 @@ struct gdi_dc_funcs HGLRC (*pwglCreateContext)(PHYSDEV); HGLRC (*pwglCreateContextAttribsARB)(PHYSDEV,HGLRC,const int*); BOOL (*pwglDeleteContext)(HGLRC); - HDC (*pwglGetPbufferDCARB)(PHYSDEV,void*); PROC (*pwglGetProcAddress)(LPCSTR); BOOL (*pwglMakeContextCurrentARB)(PHYSDEV,PHYSDEV,HGLRC); BOOL (*pwglMakeCurrent)(PHYSDEV,HGLRC); @@ -214,7 +213,7 @@ struct gdi_dc_funcs }; /* increment this when you change the DC function table */ -#define WINE_GDI_DRIVER_VERSION 27 +#define WINE_GDI_DRIVER_VERSION 28 #define GDI_PRIORITY_NULL_DRV 0 /* null driver */ #define GDI_PRIORITY_FONT_DRV 100 /* any font driver */ -- 2.11.4.GIT