Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32modes.c @ 1913:83420da906a5
Implemented Windows OpenGL support
Fixed slowdown enumerating display modes, which was hosing OpenGL as well...
Removed SDL_ from the render driver prefixes
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 17 Jul 2006 06:47:33 +0000 |
parents | c121d94672cb |
children | a788656ca29a |
comparison
equal
deleted
inserted
replaced
1912:8d384b647307 | 1913:83420da906a5 |
---|---|
21 */ | 21 */ |
22 #include "SDL_config.h" | 22 #include "SDL_config.h" |
23 | 23 |
24 #include "SDL_win32video.h" | 24 #include "SDL_win32video.h" |
25 | 25 |
26 | |
27 /* FIXME: Each call to EnumDisplaySettings() takes about 6 ms on my laptop. | |
28 With 500 or so modes, this takes almost 3 seconds to run! | |
29 */ | |
30 | 26 |
31 static SDL_bool | 27 static SDL_bool |
32 WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) | 28 WIN_GetDisplayMode(LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) |
33 { | 29 { |
34 SDL_DisplayModeData *data; | 30 SDL_DisplayModeData *data; |
56 mode->w = devmode.dmPelsWidth; | 52 mode->w = devmode.dmPelsWidth; |
57 mode->h = devmode.dmPelsHeight; | 53 mode->h = devmode.dmPelsHeight; |
58 mode->refresh_rate = devmode.dmDisplayFrequency; | 54 mode->refresh_rate = devmode.dmDisplayFrequency; |
59 mode->driverdata = data; | 55 mode->driverdata = data; |
60 | 56 |
61 hdc = CreateDC(deviceName, NULL, NULL, &devmode); | 57 if (index == ENUM_CURRENT_SETTINGS |
62 if (hdc) { | 58 && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) { |
63 char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)]; | 59 char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)]; |
64 LPBITMAPINFO bmi; | 60 LPBITMAPINFO bmi; |
65 HBITMAP hbm; | 61 HBITMAP hbm; |
66 | 62 |
67 SDL_zero(bmi_data); | 63 SDL_zero(bmi_data); |
90 } | 86 } |
91 } else if (bmi->bmiHeader.biBitCount == 8) { | 87 } else if (bmi->bmiHeader.biBitCount == 8) { |
92 mode->format = SDL_PixelFormat_Index8; | 88 mode->format = SDL_PixelFormat_Index8; |
93 } | 89 } |
94 } else { | 90 } else { |
91 /* FIXME: Can we tell what this will be? */ | |
95 switch (devmode.dmBitsPerPel) { | 92 switch (devmode.dmBitsPerPel) { |
96 case 32: | 93 case 32: |
97 mode->format = SDL_PixelFormat_RGB888; | 94 mode->format = SDL_PixelFormat_RGB888; |
98 break; | 95 break; |
99 case 24: | 96 case 24: |