Mercurial > sdl-ios-xcode
comparison src/SDL_compat.c @ 2796:9f6601537163
Clear the screen to actual black based on the format of the screen.
Use a better texture format for YUV overlay software fallbacks
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 28 Nov 2008 17:42:40 +0000 |
parents | 6bacfecbf27e |
children | 8fe261aae1bb |
comparison
equal
deleted
inserted
replaced
2795:9e7ce3069096 | 2796:9f6601537163 |
---|---|
369 int window_y = SDL_WINDOWPOS_UNDEFINED; | 369 int window_y = SDL_WINDOWPOS_UNDEFINED; |
370 Uint32 window_flags; | 370 Uint32 window_flags; |
371 Uint32 desktop_format; | 371 Uint32 desktop_format; |
372 Uint32 desired_format; | 372 Uint32 desired_format; |
373 Uint32 surface_flags; | 373 Uint32 surface_flags; |
374 Uint32 black; | |
374 | 375 |
375 if (!SDL_GetVideoDevice()) { | 376 if (!SDL_GetVideoDevice()) { |
376 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { | 377 if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { |
377 return NULL; | 378 return NULL; |
378 } | 379 } |
578 } | 579 } |
579 SDL_PublicSurface = | 580 SDL_PublicSurface = |
580 (SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface); | 581 (SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface); |
581 | 582 |
582 /* Clear the surface for display */ | 583 /* Clear the surface for display */ |
583 SDL_FillRect(SDL_PublicSurface, NULL, 0); | 584 black = SDL_MapRGB(SDL_PublicSurface->format, 0, 0, 0); |
585 SDL_FillRect(SDL_PublicSurface, NULL, black); | |
584 SDL_UpdateRect(SDL_PublicSurface, 0, 0, 0, 0); | 586 SDL_UpdateRect(SDL_PublicSurface, 0, 0, 0, 0); |
585 | 587 |
586 /* We're finally done! */ | 588 /* We're finally done! */ |
587 return SDL_PublicSurface; | 589 return SDL_PublicSurface; |
588 } | 590 } |
1435 overlay->hwdata->textureID = | 1437 overlay->hwdata->textureID = |
1436 SDL_CreateTexture(texture_format, SDL_TEXTUREACCESS_STREAMING, w, h); | 1438 SDL_CreateTexture(texture_format, SDL_TEXTUREACCESS_STREAMING, w, h); |
1437 if (overlay->hwdata->textureID) { | 1439 if (overlay->hwdata->textureID) { |
1438 overlay->hwdata->sw = NULL; | 1440 overlay->hwdata->sw = NULL; |
1439 } else { | 1441 } else { |
1442 SDL_DisplayMode current_mode; | |
1443 | |
1440 overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h); | 1444 overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h); |
1441 if (!overlay->hwdata->sw) { | 1445 if (!overlay->hwdata->sw) { |
1442 SDL_FreeYUVOverlay(overlay); | 1446 SDL_FreeYUVOverlay(overlay); |
1443 return NULL; | 1447 return NULL; |
1444 } | 1448 } |
1445 | 1449 |
1446 /* Create a supported RGB format texture for display */ | 1450 /* Create a supported RGB format texture for display */ |
1451 SDL_GetCurrentDisplayMode(¤t_mode); | |
1447 overlay->hwdata->textureID = | 1452 overlay->hwdata->textureID = |
1448 SDL_CreateTexture(SDL_PIXELFORMAT_RGB888, | 1453 SDL_CreateTexture(current_mode.format, |
1449 SDL_TEXTUREACCESS_STREAMING, w, h); | 1454 SDL_TEXTUREACCESS_STREAMING, w, h); |
1450 } | 1455 } |
1451 if (!overlay->hwdata->textureID) { | 1456 if (!overlay->hwdata->textureID) { |
1452 SDL_FreeYUVOverlay(overlay); | 1457 SDL_FreeYUVOverlay(overlay); |
1453 return NULL; | 1458 return NULL; |