Mercurial > sdl-ios-xcode
changeset 3175:e6c113f1ea43
Fixed support for 4bpp video modes enumeration, otherwise mode with zero bpp appears in the list.
author | Mike Gorchak <lestat@i.com.ua> |
---|---|
date | Mon, 08 Jun 2009 21:00:52 +0000 |
parents | c8b9c6d27476 |
children | 8c12052ddc7b |
files | src/video/win32/SDL_win32modes.c |
diffstat | 1 files changed, 27 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- 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); } } }