winex11: Activate the depth-bpp difference.

This commit is contained in:
Stefan Dösinger 2007-12-14 00:39:34 +01:00 committed by Alexandre Julliard
parent ccab10bd46
commit 5461d505d7
8 changed files with 42 additions and 27 deletions

View File

@ -1638,11 +1638,7 @@ static void test_select_object(void)
ok(hbm_old != 0, "SelectObject failed, BITSPIXEL: %d, created depth: %d\n", bpp, depths[i]); ok(hbm_old != 0, "SelectObject failed, BITSPIXEL: %d, created depth: %d\n", bpp, depths[i]);
SelectObject(hdc, hbm_old); SelectObject(hdc, hbm_old);
} else { } else {
if(bpp == 24 && depths[i] == 32) { ok(hbm_old == 0, "SelectObject should fail. BITSPIXELS: %d, created depth: %d\n", bpp, depths[i]);
todo_wine ok(hbm_old == 0, "SelectObject should fail. BITSPIXELS: %d, created depth: %d\n", bpp, depths[i]);
} else {
ok(hbm_old == 0, "SelectObject should fail. BITSPIXELS: %d, created depth: %d\n", bpp, depths[i]);
}
} }
memset(&bm, 0xAA, sizeof(bm)); memset(&bm, 0xAA, sizeof(bm));

View File

@ -2223,9 +2223,7 @@ static void test_WM_DISPLAYCHANGE(void)
continue; continue;
} }
if((start_bpp != test_bpps[i] || if(start_bpp != test_bpps[i]) {
(test_bpps[i] == 32 && last_bpp == 24)) &&
!(test_bpps[i] == 24 && start_bpp == 32)) {
todo_wine ok(last_bpp == test_bpps[i], "Set bpp %d, but WM_DISPLAYCHANGE reported bpp %d\n", test_bpps[i], last_bpp); todo_wine ok(last_bpp == test_bpps[i], "Set bpp %d, but WM_DISPLAYCHANGE reported bpp %d\n", test_bpps[i], last_bpp);
} else { } else {
ok(last_bpp == test_bpps[i], "Set bpp %d, but WM_DISPLAYCHANGE reported bpp %d\n", test_bpps[i], last_bpp); ok(last_bpp == test_bpps[i], "Set bpp %d, but WM_DISPLAYCHANGE reported bpp %d\n", test_bpps[i], last_bpp);
@ -2533,13 +2531,8 @@ static void test_EnumDisplaySettings(void)
hdc = GetDC(0); hdc = GetDC(0);
val = GetDeviceCaps(hdc, BITSPIXEL); val = GetDeviceCaps(hdc, BITSPIXEL);
if(devmode.dmBitsPerPel == 32 && val == 24) { ok(devmode.dmBitsPerPel == val, "GetDeviceCaps(BITSPIXEL) returned %d, EnumDisplaySettings returned %d\n",
todo_wine ok(devmode.dmBitsPerPel == val, "GetDeviceCaps(BITSPIXEL) returned %d, EnumDisplaySettings returned %d\n", val, devmode.dmBitsPerPel);
val, devmode.dmBitsPerPel);
} else {
ok(devmode.dmBitsPerPel == val, "GetDeviceCaps(BITSPIXEL) returned %d, EnumDisplaySettings returned %d\n",
val, devmode.dmBitsPerPel);
}
val = GetDeviceCaps(hdc, NUMCOLORS); val = GetDeviceCaps(hdc, NUMCOLORS);
if(devmode.dmBitsPerPel <= 8) { if(devmode.dmBitsPerPel <= 8) {

View File

@ -124,8 +124,6 @@ BOOL X11DRV_CreateBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, LPVOID bmBit
/* check if bpp is compatible with screen depth */ /* check if bpp is compatible with screen depth */
if (!((bitmap.bmBitsPixel == 1) || if (!((bitmap.bmBitsPixel == 1) ||
(bitmap.bmBitsPixel == screen_bpp) || (bitmap.bmBitsPixel == screen_bpp) ||
(bitmap.bmBitsPixel == 24 && screen_bpp == 32) || /* FIXME: Not compatible */
(bitmap.bmBitsPixel == 32 && screen_bpp == 24) || /* FIXME: Not compatible */
(bitmap.bmBitsPixel == 16 && screen_bpp == 15))) /* TODO: Confirm this */ (bitmap.bmBitsPixel == 16 && screen_bpp == 15))) /* TODO: Confirm this */
{ {
ERR("Trying to make bitmap with planes=%d, bpp=%d\n", ERR("Trying to make bitmap with planes=%d, bpp=%d\n",

View File

@ -104,7 +104,6 @@ static int X11DRV_desktop_GetCurrentMode(void)
{ {
unsigned int i; unsigned int i;
DWORD dwBpp = screen_bpp; DWORD dwBpp = screen_bpp;
if (dwBpp == 24) dwBpp = 32;
for (i=0; i<dd_mode_count; i++) for (i=0; i<dd_mode_count; i++)
{ {
if ( (screen_width == dd_modes[i].dwWidth) && if ( (screen_width == dd_modes[i].dwWidth) &&
@ -119,7 +118,6 @@ static int X11DRV_desktop_GetCurrentMode(void)
static LONG X11DRV_desktop_SetCurrentMode(int mode) static LONG X11DRV_desktop_SetCurrentMode(int mode)
{ {
DWORD dwBpp = screen_bpp; DWORD dwBpp = screen_bpp;
if (dwBpp == 24) dwBpp = 32;
if (dwBpp != dd_modes[mode].dwBPP) if (dwBpp != dd_modes[mode].dwBPP)
{ {
FIXME("Cannot change screen BPP from %d to %d\n", dwBpp, dd_modes[mode].dwBPP); FIXME("Cannot change screen BPP from %d to %d\n", dwBpp, dd_modes[mode].dwBPP);

View File

@ -44,7 +44,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11settings);
static LPDDHALMODEINFO dd_modes = NULL; static LPDDHALMODEINFO dd_modes = NULL;
static unsigned int dd_mode_count = 0; static unsigned int dd_mode_count = 0;
static unsigned int dd_max_modes = 0; static unsigned int dd_max_modes = 0;
static const unsigned int depths[] = {8, 16, 32}; /* All Windows drivers seen so far either support 32 bit depths, or 24 bit depths, but never both. So if we have
* a 32 bit framebuffer, report 32 bit bpps, otherwise 24 bit ones.
*/
static const unsigned int depths_24[] = {8, 16, 24};
static const unsigned int depths_32[] = {8, 16, 32};
/* pointers to functions that actually do the hard stuff */ /* pointers to functions that actually do the hard stuff */
static int (*pGetCurrentMode)(void); static int (*pGetCurrentMode)(void);
@ -92,7 +96,6 @@ void X11DRV_Settings_AddOneMode(unsigned int width, unsigned int height, unsigne
ERR("Maximum modes (%d) exceeded\n", dd_max_modes); ERR("Maximum modes (%d) exceeded\n", dd_max_modes);
return; return;
} }
if (dwBpp == 24) dwBpp = 32;
if (bpp == 0) bpp = dwBpp; if (bpp == 0) bpp = dwBpp;
info->dwWidth = width; info->dwWidth = width;
info->dwHeight = height; info->dwHeight = height;
@ -115,7 +118,7 @@ void X11DRV_Settings_AddDepthModes(void)
int i, j; int i, j;
int existing_modes = dd_mode_count; int existing_modes = dd_mode_count;
DWORD dwBpp = screen_bpp; DWORD dwBpp = screen_bpp;
if (dwBpp == 24) dwBpp = 32; const DWORD *depths = screen_bpp == 32 ? depths_32 : depths_24;
for (j=0; j<3; j++) for (j=0; j<3; j++)
{ {
@ -360,7 +363,7 @@ LONG X11DRV_ChangeDisplaySettingsEx( LPCWSTR devname, LPDEVMODEW devmode,
devmode->dmPelsWidth,devmode->dmPelsHeight, devmode->dmPelsWidth,devmode->dmPelsHeight,
devmode->dmBitsPerPel,devmode->dmDisplayFrequency, handler_name); devmode->dmBitsPerPel,devmode->dmDisplayFrequency, handler_name);
dwBpp = (devmode->dmBitsPerPel == 24) ? 32 : devmode->dmBitsPerPel; dwBpp = devmode->dmBitsPerPel;
if (devmode->dmFields & DM_BITSPERPEL) def_mode &= !dwBpp; if (devmode->dmFields & DM_BITSPERPEL) def_mode &= !dwBpp;
if (devmode->dmFields & DM_PELSWIDTH) def_mode &= !devmode->dmPelsWidth; if (devmode->dmFields & DM_PELSWIDTH) def_mode &= !devmode->dmPelsWidth;
if (devmode->dmFields & DM_PELSHEIGHT) def_mode &= !devmode->dmPelsHeight; if (devmode->dmFields & DM_PELSHEIGHT) def_mode &= !devmode->dmPelsHeight;

View File

@ -492,7 +492,37 @@ static BOOL process_attach(void)
XFree(desktop_vi); XFree(desktop_vi);
} }
screen_bpp = screen_depth; /* TODO */ switch(screen_depth) {
case 8:
screen_bpp = 8;
break;
case 15:
/* Out tests suggest that windows does not support 15 bpp color depth.
* X11 does, what should we do with these situations?
*/
FIXME("The X server is running at 15 bpp color depth\n");
screen_bpp = 15;
break;
case 16:
screen_bpp = 16;
break;
case 24:
/* This is not necessarily right. X11 always has 24 bits per pixel, but it can run
* with 24 bit framebuffers and 32 bit framebuffers. It doesn't make any difference
* for windowing, but gl applications can get visuals with alpha channels. So we
* should check the framebuffer and/or opengl formats available to find out what the
* framebuffer actually does
*/
screen_bpp = 32;
break;
default:
FIXME("Unexpected X11 depth %d bpp, what to report to app?\n", screen_depth);
screen_bpp = screen_depth;
}
XInternAtoms( display, (char **)atom_names, NB_XATOMS - FIRST_XATOM, False, X11DRV_Atoms ); XInternAtoms( display, (char **)atom_names, NB_XATOMS - FIRST_XATOM, False, X11DRV_Atoms );

View File

@ -179,7 +179,6 @@ static LONG X11DRV_XRandR_SetCurrentMode(int mode)
unsigned int i; unsigned int i;
int j; int j;
DWORD dwBpp = screen_bpp; DWORD dwBpp = screen_bpp;
if (dwBpp == 24) dwBpp = 32;
wine_tsx11_lock(); wine_tsx11_lock();
root = RootWindow (gdi_display, DefaultScreen(gdi_display)); root = RootWindow (gdi_display, DefaultScreen(gdi_display));

View File

@ -95,7 +95,6 @@ static int X11DRV_XF86VM_GetCurrentMode(void)
unsigned int i; unsigned int i;
DDHALMODEINFO cmode; DDHALMODEINFO cmode;
DWORD dwBpp = screen_bpp; DWORD dwBpp = screen_bpp;
if (dwBpp == 24) dwBpp = 32;
TRACE("Querying XVidMode current mode\n"); TRACE("Querying XVidMode current mode\n");
wine_tsx11_lock(); wine_tsx11_lock();
@ -114,7 +113,6 @@ static int X11DRV_XF86VM_GetCurrentMode(void)
static LONG X11DRV_XF86VM_SetCurrentMode(int mode) static LONG X11DRV_XF86VM_SetCurrentMode(int mode)
{ {
DWORD dwBpp = screen_bpp; DWORD dwBpp = screen_bpp;
if (dwBpp == 24) dwBpp = 32;
/* only set modes from the original color depth */ /* only set modes from the original color depth */
if (dwBpp != dd_modes[mode].dwBPP) if (dwBpp != dd_modes[mode].dwBPP)
{ {