comparison src/video/win32/SDL_win32modes.c @ 3097:0d12e8f1de3c

Date: Thu, 05 Feb 2009 18:07:35 +0100 From: Stefan Klug Subject: [SDL] SDL 1.3 WinCE backend as promised, I've started to work on the WinCE backend of SDL 1.3 I've modified the win32 video backend and the gdi renderer, to work properly in WinCE. The results till now are great, but there is still some work to do. Attached are two patches with my changes. I would be happy if someone could review and propably commit them. The first one (configure.in.patch) should be straight forward without any side effects. The second one does the necessary changes to the win32 backend. I was really unhappy to start slicing this shiny new backend with #ifdef/#endif but I saw no other option. The most problematic issues are: - WinCe has no GetDIBits, so its practically impossible to fill a BITMAPINFO with correct values. I therefore removed the bmi member from the GDI_RenderData in SDL_gdirender.c to prevent usage of a not or not properly initialized bmi. - In SDL_win32window.c I exchanged some ASCII function by their general counterparts, (In CE only the Unicode versions are available). I don't know if this has a negative effect when running in win32 Cheers Stefan
author Sam Lantinga <slouken@libsdl.org>
date Mon, 23 Mar 2009 05:35:21 +0000
parents 99210400e8b9
children 7f684f249ec9
comparison
equal deleted inserted replaced
3096:ae4e80dbe330 3097:0d12e8f1de3c
51 mode->format = SDL_PIXELFORMAT_UNKNOWN; 51 mode->format = SDL_PIXELFORMAT_UNKNOWN;
52 mode->w = devmode.dmPelsWidth; 52 mode->w = devmode.dmPelsWidth;
53 mode->h = devmode.dmPelsHeight; 53 mode->h = devmode.dmPelsHeight;
54 mode->refresh_rate = devmode.dmDisplayFrequency; 54 mode->refresh_rate = devmode.dmDisplayFrequency;
55 mode->driverdata = data; 55 mode->driverdata = data;
56 56 #ifdef _WIN32_WCE
57 /* In WinCE EnumDisplaySettings(ENUM_CURRENT_SETTINGS) doesn't take the user defined orientation
58 into account but GetSystemMetrixs does. */
59 if(index == ENUM_CURRENT_SETTINGS) {
60 mode->w = GetSystemMetrics(SM_CXSCREEN);
61 mode->h = GetSystemMetrics(SM_CYSCREEN);
62 }
63 #endif
64
65 /* WinCE has no GetDIBits, therefore we can't use it to get the display format */
66 #ifndef _WIN32_WCE
57 if (index == ENUM_CURRENT_SETTINGS 67 if (index == ENUM_CURRENT_SETTINGS
58 && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) { 68 && (hdc = CreateDC(deviceName, NULL, NULL, NULL)) != NULL) {
59 char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)]; 69 char bmi_data[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
60 LPBITMAPINFO bmi; 70 LPBITMAPINFO bmi;
61 HBITMAP hbm; 71 HBITMAP hbm;
85 break; 95 break;
86 } 96 }
87 } else if (bmi->bmiHeader.biBitCount == 8) { 97 } else if (bmi->bmiHeader.biBitCount == 8) {
88 mode->format = SDL_PIXELFORMAT_INDEX8; 98 mode->format = SDL_PIXELFORMAT_INDEX8;
89 } 99 }
90 } else { 100 } else
101 #endif /* _WIN32_WCE */
102 {
103
91 /* FIXME: Can we tell what this will be? */ 104 /* FIXME: Can we tell what this will be? */
92 switch (devmode.dmBitsPerPel) { 105 switch (devmode.dmBitsPerPel) {
93 case 32: 106 case 32:
94 mode->format = SDL_PIXELFORMAT_RGB888; 107 mode->format = SDL_PIXELFORMAT_RGB888;
95 break; 108 break;
196 int 209 int
197 WIN_SetDisplayMode(_THIS, SDL_DisplayMode * mode) 210 WIN_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
198 { 211 {
199 SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; 212 SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata;
200 LONG status; 213 LONG status;
214
215 #ifdef _WIN32_WCE
216 /* TODO: implement correctly.
217 On my Asus MyPAL, if I execute the code below
218 I get DISP_CHANGE_BADFLAGS and the Titlebar of the fullscreen window stays
219 visible ... (SDL_RaiseWindow() would fix that one)*/
220 return 0;
221 #endif
201 222
202 status = 223 status =
203 ChangeDisplaySettingsEx(data->DeviceName, &data->DeviceMode, NULL, 224 ChangeDisplaySettingsEx(data->DeviceName, &data->DeviceMode, NULL,
204 CDS_FULLSCREEN, NULL); 225 CDS_FULLSCREEN, NULL);
205 if (status == DISP_CHANGE_SUCCESSFUL) { 226 if (status == DISP_CHANGE_SUCCESSFUL) {