| | |
| | | /* |
| | | Simple DirectMedia Layer |
| | | Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org> |
| | | Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> |
| | | |
| | | This software is provided 'as-is', without any express or implied |
| | | warranty. In no event will the authors be held liable for any damages |
| | |
| | | misrepresented as being the original software. |
| | | 3. This notice may not be removed or altered from any source distribution. |
| | | */ |
| | | #include "SDL_config.h" |
| | | #include "../../SDL_internal.h" |
| | | |
| | | #if SDL_VIDEO_DRIVER_WINDOWS |
| | | |
| | |
| | | data->DeviceMode.dmFields = |
| | | (DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY | |
| | | DM_DISPLAYFLAGS); |
| | | data->ScaleX = 1.0f; |
| | | data->ScaleY = 1.0f; |
| | | |
| | | /* Fill in the mode information */ |
| | | mode->format = SDL_PIXELFORMAT_UNKNOWN; |
| | |
| | | char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)]; |
| | | LPBITMAPINFO bmi; |
| | | HBITMAP hbm; |
| | | int logical_width = GetDeviceCaps( hdc, HORZRES ); |
| | | int logical_height = GetDeviceCaps( hdc, VERTRES ); |
| | | |
| | | data->ScaleX = (float)logical_width / devmode.dmPelsWidth; |
| | | data->ScaleY = (float)logical_height / devmode.dmPelsHeight; |
| | | mode->w = logical_width; |
| | | mode->h = logical_height; |
| | | |
| | | SDL_zero(bmi_data); |
| | | bmi = (LPBITMAPINFO) bmi_data; |
| | |
| | | } else if (bmi->bmiHeader.biBitCount == 4) { |
| | | mode->format = SDL_PIXELFORMAT_INDEX4LSB; |
| | | } |
| | | } else { |
| | | } else { |
| | | /* FIXME: Can we tell what this will be? */ |
| | | if ((devmode.dmFields & DM_BITSPERPEL) == DM_BITSPERPEL) { |
| | | switch (devmode.dmBitsPerPel) { |
| | |
| | | { |
| | | SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata; |
| | | |
| | | rect->x = (int)data->DeviceMode.dmPosition.x; |
| | | rect->y = (int)data->DeviceMode.dmPosition.y; |
| | | rect->w = data->DeviceMode.dmPelsWidth; |
| | | rect->h = data->DeviceMode.dmPelsHeight; |
| | | rect->x = (int)SDL_ceil(data->DeviceMode.dmPosition.x * data->ScaleX); |
| | | rect->y = (int)SDL_ceil(data->DeviceMode.dmPosition.y * data->ScaleY); |
| | | rect->w = (int)SDL_ceil(data->DeviceMode.dmPelsWidth * data->ScaleX); |
| | | rect->h = (int)SDL_ceil(data->DeviceMode.dmPelsHeight * data->ScaleY); |
| | | |
| | | return 0; |
| | | } |
| | |
| | | if (!SDL_AddDisplayMode(display, &mode)) { |
| | | SDL_free(mode.driverdata); |
| | | } |
| | | } |
| | | else { |
| | | } else { |
| | | SDL_free(mode.driverdata); |
| | | } |
| | | } |