# HG changeset patch # User Mike Gorchak # Date 1244494852 0 # Node ID e6c113f1ea432dbb0d341c813aec282304e29625 # Parent c8b9c6d274766655cd3c64b0bb0a27447eb7e615 Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list. diff -r c8b9c6d27476 -r e6c113f1ea43 src/video/win32/SDL_win32modes.c --- a/src/video/win32/SDL_win32modes.c Mon Jun 08 19:24:38 2009 +0000 +++ b/src/video/win32/SDL_win32modes.c Mon Jun 08 21:00:52 2009 +0000 @@ -96,29 +96,35 @@ } } else if (bmi->bmiHeader.biBitCount == 8) { mode->format = SDL_PIXELFORMAT_INDEX8; + } else if (bmi->bmiHeader.biBitCount == 4) { + mode->format = SDL_PIXELFORMAT_INDEX4LSB; } } else #endif /* _WIN32_WCE */ { - /* FIXME: Can we tell what this will be? */ - switch (devmode.dmBitsPerPel) { - case 32: - mode->format = SDL_PIXELFORMAT_RGB888; - break; - case 24: - mode->format = SDL_PIXELFORMAT_RGB24; - break; - case 16: - mode->format = SDL_PIXELFORMAT_RGB565; - break; - case 15: - mode->format = SDL_PIXELFORMAT_RGB555; - break; - case 8: - mode->format = SDL_PIXELFORMAT_INDEX8; - break; - } + if ((devmode.dmFields & DM_BITSPERPEL)==DM_BITSPERPEL) { + switch (devmode.dmBitsPerPel) { + case 32: + mode->format = SDL_PIXELFORMAT_RGB888; + break; + case 24: + mode->format = SDL_PIXELFORMAT_RGB24; + break; + case 16: + mode->format = SDL_PIXELFORMAT_RGB565; + break; + case 15: + mode->format = SDL_PIXELFORMAT_RGB555; + break; + case 8: + mode->format = SDL_PIXELFORMAT_INDEX8; + break; + case 4: + mode->format = SDL_PIXELFORMAT_INDEX4LSB; + break; + } + } } return SDL_TRUE; } @@ -200,8 +206,9 @@ if (!WIN_GetDisplayMode(data->DeviceName, i, &mode)) { break; } - if (!SDL_AddDisplayMode(_this->current_display, &mode)) { - SDL_free(mode.driverdata); + if (mode.format != SDL_PIXELFORMAT_UNKNOWN) + if (!SDL_AddDisplayMode(_this->current_display, &mode)) { + SDL_free(mode.driverdata); } } }