Mercurial > sdl-ios-xcode
comparison src/video/directfb/SDL_DirectFB_modes.c @ 3013:8cc00819c8d6
Reverted Bob's indent checkin
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 10 Jan 2009 21:50:26 +0000 |
parents | 8f4ed5ec2b06 |
children | d72a0dd80e8b |
comparison
equal
deleted
inserted
replaced
3012:7e30c2dc7783 | 3013:8cc00819c8d6 |
---|---|
202 SDL_DFB_DEVICEDATA(_this); | 202 SDL_DFB_DEVICEDATA(_this); |
203 DFBDisplayLayerConfig config; | 203 DFBDisplayLayerConfig config; |
204 DFBDisplayLayerConfigFlags failed; | 204 DFBDisplayLayerConfigFlags failed; |
205 int ret; | 205 int ret; |
206 | 206 |
207 SDL_DFB_CHECKERR(data-> | 207 SDL_DFB_CHECKERR(data->layer-> |
208 layer->SetCooperativeLevel(data->layer, | 208 SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE)); |
209 DLSCL_ADMINISTRATIVE)); | |
210 config.width = mode->w; | 209 config.width = mode->w; |
211 config.height = mode->h; | 210 config.height = mode->h; |
212 config.pixelformat = SDLToDFBPixelFormat(mode->format); | 211 config.pixelformat = SDLToDFBPixelFormat(mode->format); |
213 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT; | 212 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_PIXELFORMAT; |
214 if (devdata->use_yuv_underlays) { | 213 if (devdata->use_yuv_underlays) { |
215 config.flags |= DLCONF_OPTIONS; | 214 config.flags |= DLCONF_OPTIONS; |
216 config.options = DLOP_ALPHACHANNEL; | 215 config.options = DLOP_ALPHACHANNEL; |
217 } | 216 } |
218 failed = 0; | 217 failed = 0; |
219 data->layer->TestConfiguration(data->layer, &config, &failed); | 218 data->layer->TestConfiguration(data->layer, &config, &failed); |
220 SDL_DFB_CHECKERR(data-> | 219 SDL_DFB_CHECKERR(data->layer-> |
221 layer->SetCooperativeLevel(data->layer, DLSCL_SHARED)); | 220 SetCooperativeLevel(data->layer, DLSCL_SHARED)); |
222 if (failed == 0) | 221 if (failed == 0) |
223 SDL_AddDisplayMode(_this->current_display, mode); | 222 SDL_AddDisplayMode(_this->current_display, mode); |
224 else | 223 else |
225 SDL_DFB_DEBUG("Mode %d x %d not available: %x\n", mode->w, mode->h, | 224 SDL_DFB_DEBUG("Mode %d x %d not available: %x\n", mode->w, mode->h, |
226 failed); | 225 failed); |
258 for (i = 0; i < DFB_MAX_SCREENS; i++) { | 257 for (i = 0; i < DFB_MAX_SCREENS; i++) { |
259 screencbdata->gralayer[i] = -1; | 258 screencbdata->gralayer[i] = -1; |
260 screencbdata->vidlayer[i] = -1; | 259 screencbdata->vidlayer[i] = -1; |
261 } | 260 } |
262 | 261 |
263 SDL_DFB_CHECKERR(devdata-> | 262 SDL_DFB_CHECKERR(devdata->dfb-> |
264 dfb->EnumScreens(devdata->dfb, &cbScreens, | 263 EnumScreens(devdata->dfb, &cbScreens, screencbdata)); |
265 screencbdata)); | |
266 | 264 |
267 for (i = 0; i < screencbdata->numscreens; i++) { | 265 for (i = 0; i < screencbdata->numscreens; i++) { |
268 IDirectFBScreen *screen; | 266 IDirectFBScreen *screen; |
269 | 267 |
270 SDL_DFB_CHECKERR(devdata-> | 268 SDL_DFB_CHECKERR(devdata->dfb-> |
271 dfb->GetScreen(devdata->dfb, | 269 GetScreen(devdata->dfb, screencbdata->screenid[i], |
272 screencbdata->screenid[i], &screen)); | 270 &screen)); |
273 | 271 |
274 screencbdata->aux = i; | 272 screencbdata->aux = i; |
275 SDL_DFB_CHECKERR(screen->EnumDisplayLayers | 273 SDL_DFB_CHECKERR(screen-> |
276 (screen, &cbLayers, screencbdata)); | 274 EnumDisplayLayers(screen, &cbLayers, screencbdata)); |
277 #if (DIRECTFB_MAJOR_VERSION >= 1) | 275 #if (DIRECTFB_MAJOR_VERSION >= 1) |
278 screen->GetSize(screen, &tcw[i], &tch[i]); | 276 screen->GetSize(screen, &tcw[i], &tch[i]); |
279 #else | 277 #else |
280 /* FIXME: this is only used to center windows | 278 /* FIXME: this is only used to center windows |
281 * Should be done otherwise, e.g. get surface from layer | 279 * Should be done otherwise, e.g. get surface from layer |
293 SDL_DFB_DEBUG("SDL directfb video driver - %s %s\n", __DATE__, __TIME__); | 291 SDL_DFB_DEBUG("SDL directfb video driver - %s %s\n", __DATE__, __TIME__); |
294 SDL_DFB_DEBUG("Using %s (%s) driver.\n", caps.name, caps.vendor); | 292 SDL_DFB_DEBUG("Using %s (%s) driver.\n", caps.name, caps.vendor); |
295 SDL_DFB_DEBUG("Found %d screens\n", screencbdata->numscreens); | 293 SDL_DFB_DEBUG("Found %d screens\n", screencbdata->numscreens); |
296 | 294 |
297 for (i = 0; i < screencbdata->numscreens; i++) { | 295 for (i = 0; i < screencbdata->numscreens; i++) { |
298 SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb, | 296 SDL_DFB_CHECKERR(devdata->dfb-> |
299 screencbdata-> | 297 GetDisplayLayer(devdata->dfb, |
300 gralayer[i], &layer)); | 298 screencbdata->gralayer[i], &layer)); |
301 | 299 |
302 SDL_DFB_CHECKERR(layer->SetCooperativeLevel | 300 SDL_DFB_CHECKERR(layer-> |
303 (layer, DLSCL_ADMINISTRATIVE)); | 301 SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE)); |
304 layer->EnableCursor(layer, 1); | 302 layer->EnableCursor(layer, 1); |
305 SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0)); | 303 SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0)); |
306 | 304 |
307 if (devdata->use_yuv_underlays) { | 305 if (devdata->use_yuv_underlays) { |
308 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS; | 306 dlc.flags = DLCONF_PIXELFORMAT | DLCONF_OPTIONS; |
381 int ret; | 379 int ret; |
382 | 380 |
383 data.nummodes = 0; | 381 data.nummodes = 0; |
384 /* Enumerate the available fullscreen modes */ | 382 /* Enumerate the available fullscreen modes */ |
385 SDL_DFB_CALLOC(data.modelist, DFB_MAX_MODES, sizeof(SDL_DisplayMode)); | 383 SDL_DFB_CALLOC(data.modelist, DFB_MAX_MODES, sizeof(SDL_DisplayMode)); |
386 SDL_DFB_CHECKERR(devdata-> | 384 SDL_DFB_CHECKERR(devdata->dfb-> |
387 dfb->EnumVideoModes(devdata->dfb, EnumModesCallback, | 385 EnumVideoModes(devdata->dfb, EnumModesCallback, &data)); |
388 &data)); | |
389 | 386 |
390 for (i = 0; i < data.nummodes; ++i) { | 387 for (i = 0; i < data.nummodes; ++i) { |
391 mode = data.modelist[i]; | 388 mode = data.modelist[i]; |
392 | 389 |
393 mode.format = SDL_PIXELFORMAT_ARGB8888; | 390 mode.format = SDL_PIXELFORMAT_ARGB8888; |
420 DFB_DisplayData *data = (DFB_DisplayData *) SDL_CurrentDisplay.driverdata; | 417 DFB_DisplayData *data = (DFB_DisplayData *) SDL_CurrentDisplay.driverdata; |
421 DFBDisplayLayerConfig config, rconfig; | 418 DFBDisplayLayerConfig config, rconfig; |
422 DFBDisplayLayerConfigFlags fail = 0; | 419 DFBDisplayLayerConfigFlags fail = 0; |
423 DFBResult ret; | 420 DFBResult ret; |
424 | 421 |
425 SDL_DFB_CHECKERR(data-> | 422 SDL_DFB_CHECKERR(data->layer-> |
426 layer->SetCooperativeLevel(data->layer, | 423 SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE)); |
427 DLSCL_ADMINISTRATIVE)); | |
428 | 424 |
429 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config)); | 425 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config)); |
430 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT; | 426 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT; |
431 if (mode->format != SDL_PIXELFORMAT_UNKNOWN) { | 427 if (mode->format != SDL_PIXELFORMAT_UNKNOWN) { |
432 config.flags |= DLCONF_PIXELFORMAT; | 428 config.flags |= DLCONF_PIXELFORMAT; |
460 //SDL_DFB_CHECKERR(data->layer->SetSourceRectangle(data->layer, 0, 0, config.width, config.height)); | 456 //SDL_DFB_CHECKERR(data->layer->SetSourceRectangle(data->layer, 0, 0, config.width, config.height)); |
461 #endif | 457 #endif |
462 | 458 |
463 /* Double check */ | 459 /* Double check */ |
464 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig)); | 460 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig)); |
465 SDL_DFB_CHECKERR(data-> | 461 SDL_DFB_CHECKERR(data->layer-> |
466 layer->SetCooperativeLevel(data->layer, DLSCL_SHARED)); | 462 SetCooperativeLevel(data->layer, DLSCL_SHARED)); |
467 | 463 |
468 if ((config.width != rconfig.width) || | 464 if ((config.width != rconfig.width) || |
469 (config.height != rconfig.height) || | 465 (config.height != rconfig.height) || |
470 ((mode->format != SDL_PIXELFORMAT_UNKNOWN) | 466 ((mode->format != SDL_PIXELFORMAT_UNKNOWN) |
471 && (config.pixelformat != rconfig.pixelformat))) { | 467 && (config.pixelformat != rconfig.pixelformat))) { |
504 for (i = 0; i < SDL_GetNumVideoDisplays(); i++) { | 500 for (i = 0; i < SDL_GetNumVideoDisplays(); i++) { |
505 DFB_DisplayData *dispdata = | 501 DFB_DisplayData *dispdata = |
506 (DFB_DisplayData *) _this->displays[i].driverdata; | 502 (DFB_DisplayData *) _this->displays[i].driverdata; |
507 | 503 |
508 if (dispdata->layer) { | 504 if (dispdata->layer) { |
509 SDL_DFB_CHECK(dispdata-> | 505 SDL_DFB_CHECK(dispdata->layer-> |
510 layer->SetCooperativeLevel(dispdata->layer, | 506 SetCooperativeLevel(dispdata->layer, |
511 DLSCL_ADMINISTRATIVE)); | 507 DLSCL_ADMINISTRATIVE)); |
512 SDL_DFB_CHECK(dispdata-> | 508 SDL_DFB_CHECK(dispdata->layer-> |
513 layer->SetCursorOpacity(dispdata->layer, 0x00)); | 509 SetCursorOpacity(dispdata->layer, 0x00)); |
514 SDL_DFB_CHECK(dispdata-> | 510 SDL_DFB_CHECK(dispdata->layer-> |
515 layer->SetCooperativeLevel(dispdata->layer, | 511 SetCooperativeLevel(dispdata->layer, DLSCL_SHARED)); |
516 DLSCL_SHARED)); | |
517 } | 512 } |
518 | 513 |
519 SDL_DFB_RELEASE(dispdata->layer); | 514 SDL_DFB_RELEASE(dispdata->layer); |
520 SDL_DFB_RELEASE(dispdata->vidlayer); | 515 SDL_DFB_RELEASE(dispdata->vidlayer); |
521 | 516 |