[PATCH v2 1/2] winex11.drv: Factor out describe_pixel_format() function.
Paul Gofman
pgofman at codeweavers.com
Wed Feb 24 08:04:52 CST 2021
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
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 3e25e485e6d..e0e5849f010 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1594,8 +1594,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;
@@ -1604,23 +1603,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;
@@ -1723,6 +1712,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
*/
--
2.29.2
More information about the wine-devel
mailing list