Alexandre Julliard : winex11: Add a helper function to get a pixel format index.
Alexandre Julliard
julliard at winehq.org
Thu Oct 4 13:38:36 CDT 2012
Module: wine
Branch: master
Commit: 3d73e0a3570af4285d627447e4cc6d61e334684a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3d73e0a3570af4285d627447e4cc6d61e334684a
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Oct 3 23:01:19 2012 +0200
winex11: Add a helper function to get a pixel format index.
---
dlls/winex11.drv/opengl.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 20591e2..b8c55c2 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -1043,6 +1043,11 @@ static inline BOOL is_onscreen_pixel_format( int format )
return format > 0 && format <= nb_onscreen_formats;
}
+static inline int pixel_format_index( const struct wgl_pixel_format *format )
+{
+ return format - pixel_formats + 1;
+}
+
/* GLX can advertise dozens of different pixelformats including offscreen and onscreen ones.
* In our WGL implementation we only support a subset of these formats namely the format of
* Wine's main visual and offscreen formats (if they are available).
@@ -1506,7 +1511,7 @@ static int glxdrv_wglGetPixelFormat( HDC hdc )
if ((gl = get_gl_drawable( WindowFromDC( hdc ), hdc )))
{
- ret = gl->format - pixel_formats + 1;
+ ret = pixel_format_index( gl->format );
/* Offscreen formats can't be used with traditional WGL calls.
* As has been verified on Windows GetPixelFormat doesn't fail but returns iPixelFormat=1. */
if (!is_onscreen_pixel_format( ret )) ret = 1;
@@ -1550,7 +1555,7 @@ static BOOL glxdrv_wglSetPixelFormat( HDC hdc, int iPixelFormat, const PIXELFORM
if ((gl = get_gl_drawable( hwnd, hdc )))
{
- int prev = gl->format - pixel_formats + 1;
+ int prev = pixel_format_index( gl->format );
release_gl_drawable( gl );
return prev == iPixelFormat; /* cannot change it if already set */
}
More information about the wine-cvs
mailing list