winex11.drv: Fix bit shifts in pixel format description for RGBA formats.

This commit is contained in:
Paul Gofman 2023-04-10 16:20:38 -06:00 committed by Alexandre Julliard
parent d70a652da8
commit 01c59b3f18
2 changed files with 22 additions and 6 deletions

View file

@ -288,7 +288,20 @@ static void test_choosepixelformat(void)
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
ok( test_pfd(&pfd, NULL), "Simple pfd failed\n" );
ok( test_pfd(&pfd, &ret_fmt), "Simple pfd failed\n" );
ok( ret_fmt.cColorBits == 32, "Got %u.\n", ret_fmt.cColorBits );
ok( !ret_fmt.cBlueShift, "Got %u.\n", ret_fmt.cBlueShift );
ok( ret_fmt.cBlueBits == 8, "Got %u.\n", ret_fmt.cBlueBits );
ok( ret_fmt.cRedBits == 8, "Got %u.\n", ret_fmt.cRedBits );
ok( ret_fmt.cGreenBits == 8, "Got %u.\n", ret_fmt.cGreenBits );
ok( ret_fmt.cGreenShift == 8, "Got %u.\n", ret_fmt.cGreenShift );
ok( ret_fmt.cRedShift == 16, "Got %u.\n", ret_fmt.cRedShift );
ok( !ret_fmt.cAlphaBits || ret_fmt.cAlphaBits == 8, "Got %u.\n", ret_fmt.cAlphaBits );
if (ret_fmt.cAlphaBits)
ok( ret_fmt.cAlphaShift == 24, "Got %u.\n", ret_fmt.cAlphaShift );
else
ok( !ret_fmt.cAlphaShift, "Got %u.\n", ret_fmt.cAlphaShift );
pfd.dwFlags |= PFD_DOUBLEBUFFER_DONTCARE;
ok( test_pfd(&pfd, NULL), "PFD_DOUBLEBUFFER_DONTCARE failed\n" );
pfd.dwFlags |= PFD_STEREO_DONTCARE;

View file

@ -1601,14 +1601,17 @@ static int describe_pixel_format( int iPixelFormat, PIXELFORMATDESCRIPTOR *ppfd,
pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_BLUE_SIZE, &bb);
pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_ALPHA_SIZE, &ab);
ppfd->cRedBits = rb;
ppfd->cRedShift = gb + bb + ab;
ppfd->cBlueBits = bb;
ppfd->cBlueShift = ab;
ppfd->cBlueShift = 0;
ppfd->cGreenBits = gb;
ppfd->cGreenShift = bb + ab;
ppfd->cGreenShift = bb;
ppfd->cRedBits = rb;
ppfd->cRedShift = gb + bb;
ppfd->cAlphaBits = ab;
ppfd->cAlphaShift = 0;
if (ab)
ppfd->cAlphaShift = rb + gb + bb;
else
ppfd->cAlphaShift = 0;
} else {
ppfd->cRedBits = 0;
ppfd->cRedShift = 0;