# HG changeset patch # User Sam Lantinga # Date 1227894160 0 # Node ID 9f66015371630500daf5724d8b706838818be53f # Parent 9e7ce306909623f4ebf69f0f1ebfd22d2e1a6c2d Clear the screen to actual black based on the format of the screen. Use a better texture format for YUV overlay software fallbacks diff -r 9e7ce3069096 -r 9f6601537163 src/SDL_compat.c --- a/src/SDL_compat.c Thu Nov 27 22:11:01 2008 +0000 +++ b/src/SDL_compat.c Fri Nov 28 17:42:40 2008 +0000 @@ -371,6 +371,7 @@ Uint32 desktop_format; Uint32 desired_format; Uint32 surface_flags; + Uint32 black; if (!SDL_GetVideoDevice()) { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) { @@ -580,7 +581,8 @@ (SDL_ShadowSurface ? SDL_ShadowSurface : SDL_VideoSurface); /* Clear the surface for display */ - SDL_FillRect(SDL_PublicSurface, NULL, 0); + black = SDL_MapRGB(SDL_PublicSurface->format, 0, 0, 0); + SDL_FillRect(SDL_PublicSurface, NULL, black); SDL_UpdateRect(SDL_PublicSurface, 0, 0, 0, 0); /* We're finally done! */ @@ -1437,6 +1439,8 @@ if (overlay->hwdata->textureID) { overlay->hwdata->sw = NULL; } else { + SDL_DisplayMode current_mode; + overlay->hwdata->sw = SDL_SW_CreateYUVTexture(texture_format, w, h); if (!overlay->hwdata->sw) { SDL_FreeYUVOverlay(overlay); @@ -1444,8 +1448,9 @@ } /* Create a supported RGB format texture for display */ + SDL_GetCurrentDisplayMode(¤t_mode); overlay->hwdata->textureID = - SDL_CreateTexture(SDL_PIXELFORMAT_RGB888, + SDL_CreateTexture(current_mode.format, SDL_TEXTUREACCESS_STREAMING, w, h); } if (!overlay->hwdata->textureID) {