Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Clear the screen to actual black based on the format of the screen.
Browse files Browse the repository at this point in the history
Use a better texture format for YUV overlay software fallbacks
  • Loading branch information
slouken committed Nov 28, 2008
1 parent 0e4a10e commit f3acc31
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/SDL_compat.c
Expand Up @@ -371,6 +371,7 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
Uint32 desktop_format;
Uint32 desired_format;
Uint32 surface_flags;
Uint32 black;

if (!SDL_GetVideoDevice()) {
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) {
Expand Down Expand Up @@ -580,7 +581,8 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
(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! */
Expand Down Expand Up @@ -1437,15 +1439,18 @@ SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display)
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);
return NULL;
}

/* Create a supported RGB format texture for display */
SDL_GetCurrentDisplayMode(&current_mode);
overlay->hwdata->textureID =
SDL_CreateTexture(SDL_PIXELFORMAT_RGB888,
SDL_CreateTexture(current_mode.format,
SDL_TEXTUREACCESS_STREAMING, w, h);
}
if (!overlay->hwdata->textureID) {
Expand Down

0 comments on commit f3acc31

Please sign in to comment.