Paul Gofman : winex11.drv: Factor out describe_pixel_format() function.
Alexandre Julliard
julliard at winehq.org
Thu Mar 4 15:53:38 CST 2021
Module: wine
Branch: master
Commit: bfa3c9561161193424971cfbbeb4e915e96fffc4
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bfa3c9561161193424971cfbbeb4e915e96fffc4
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Wed Feb 24 17:04:52 2021 +0300
winex11.drv: Factor out describe_pixel_format() function.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winex11.drv/opengl.c | 37 ++++++++++++++++++++++++-------------
1 file changed, 24 insertions(+), 13 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 4a3ab31273a..373182dec44 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1533,8 +1533,7 @@ void destroy_gl_drawable( HWND hwnd )
*
* Get the pixel-format descriptor associated to the given id
*/
-static int WINAPI glxdrv_wglDescribePixelFormat( HDC hdc, int iPixelFormat,
- UINT nBytes, PIXELFORMATDESCRIPTOR *ppfd)
+static int WINAPI describe_pixel_format( int iPixelFormat, PIXELFORMATDESCRIPTOR *ppfd, BOOL allow_offscreen )
{
/*XVisualInfo *vis;*/
int value;
@@ -1543,23 +1542,13 @@ static int WINAPI glxdrv_wglDescribePixelFormat( HDC hdc, int iPixelFormat,
if (!has_opengl()) return 0;
- TRACE("(%p,%d,%d,%p)\n", hdc, iPixelFormat, nBytes, ppfd);
-
- if (!ppfd) return nb_onscreen_formats;
-
/* 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 = get_pixel_format(gdi_display, iPixelFormat, FALSE /* Offscreen */);
+ fmt = get_pixel_format(gdi_display, iPixelFormat, allow_offscreen);
if (!fmt) {
WARN("unexpected format %d\n", iPixelFormat);
return 0;
}
- if (nBytes < sizeof(PIXELFORMATDESCRIPTOR)) {
- ERR("Wrong structure size !\n");
- /* Should set error */
- return 0;
- }
-
memset(ppfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
ppfd->nSize = sizeof(PIXELFORMATDESCRIPTOR);
ppfd->nVersion = 1;
@@ -1662,6 +1651,28 @@ static int WINAPI glxdrv_wglDescribePixelFormat( HDC hdc, int iPixelFormat,
return nb_onscreen_formats;
}
+/**
+ * glxdrv_DescribePixelFormat
+ *
+ * Get the pixel-format descriptor associated to the given id
+ */
+static int WINAPI glxdrv_wglDescribePixelFormat( HDC hdc, int iPixelFormat,
+ UINT nBytes, PIXELFORMATDESCRIPTOR *ppfd)
+{
+ TRACE("(%p,%d,%d,%p)\n", hdc, iPixelFormat, nBytes, ppfd);
+
+ if (!ppfd) return nb_onscreen_formats;
+
+ if (nBytes < sizeof(PIXELFORMATDESCRIPTOR))
+ {
+ ERR("Wrong structure size !\n");
+ /* Should set error */
+ return 0;
+ }
+
+ return describe_pixel_format(iPixelFormat, ppfd, FALSE);
+}
+
/***********************************************************************
* glxdrv_wglGetPixelFormat
*/
More information about the wine-cvs
mailing list