Consolidate Create_Screen and ReInit_Screen for the SDL1 drivers.
SDL1 drivers use a special SDL1_ReInit_Screen function not available to SDL2 systems.
This commit is contained in:
@@ -172,7 +172,7 @@ TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int togglef
|
|||||||
|
|
||||||
for (i = 0; i < TFB_GFX_NUMSCREENS; i++)
|
for (i = 0; i < TFB_GFX_NUMSCREENS; i++)
|
||||||
{
|
{
|
||||||
if (0 != ReInit_Screen (&SDL_Screens[i], format_conv_surf,
|
if (0 != SDL1_ReInit_Screen (&SDL_Screens[i], format_conv_surf,
|
||||||
ScreenWidth, ScreenHeight))
|
ScreenWidth, ScreenHeight))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -201,7 +201,7 @@ TFB_GL_ConfigureVideo (int driver, int flags, int width, int height, int togglef
|
|||||||
{
|
{
|
||||||
if (!GL_Screens[i].active)
|
if (!GL_Screens[i].active)
|
||||||
continue;
|
continue;
|
||||||
if (0 != ReInit_Screen (&GL_Screens[i].scaled, format_conv_surf,
|
if (0 != SDL1_ReInit_Screen (&GL_Screens[i].scaled, format_conv_surf,
|
||||||
ScreenWidth * 2, ScreenHeight * 2))
|
ScreenWidth * 2, ScreenHeight * 2))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int toggl
|
|||||||
|
|
||||||
for (i = 0; i < TFB_GFX_NUMSCREENS; i++)
|
for (i = 0; i < TFB_GFX_NUMSCREENS; i++)
|
||||||
{
|
{
|
||||||
if (0 != ReInit_Screen (&SDL_Screens[i], format_conv_surf,
|
if (0 != SDL1_ReInit_Screen (&SDL_Screens[i], format_conv_surf,
|
||||||
ScreenWidth, ScreenHeight))
|
ScreenWidth, ScreenHeight))
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -210,19 +210,19 @@ TFB_Pure_ConfigureVideo (int driver, int flags, int width, int height, int toggl
|
|||||||
SDL_Screen = SDL_Screens[0];
|
SDL_Screen = SDL_Screens[0];
|
||||||
TransitionScreen = SDL_Screens[2];
|
TransitionScreen = SDL_Screens[2];
|
||||||
|
|
||||||
if (0 != ReInit_Screen (&fade_color_surface, format_conv_surf,
|
if (0 != SDL1_ReInit_Screen (&fade_color_surface, format_conv_surf,
|
||||||
ScreenWidth, ScreenHeight))
|
ScreenWidth, ScreenHeight))
|
||||||
return -1;
|
return -1;
|
||||||
fade_color = SDL_MapRGB (fade_color_surface->format, 0, 0, 0);
|
fade_color = SDL_MapRGB (fade_color_surface->format, 0, 0, 0);
|
||||||
SDL_FillRect (fade_color_surface, NULL, fade_color);
|
SDL_FillRect (fade_color_surface, NULL, fade_color);
|
||||||
|
|
||||||
if (0 != ReInit_Screen (&fade_temp, format_conv_surf,
|
if (0 != SDL1_ReInit_Screen (&fade_temp, format_conv_surf,
|
||||||
ScreenWidth, ScreenHeight))
|
ScreenWidth, ScreenHeight))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (ScreenWidthActual > ScreenWidth || ScreenHeightActual > ScreenHeight)
|
if (ScreenWidthActual > ScreenWidth || ScreenHeightActual > ScreenHeight)
|
||||||
{
|
{
|
||||||
if (0 != ReInit_Screen (&scaled_display, format_conv_surf,
|
if (0 != SDL1_ReInit_Screen (&scaled_display, format_conv_surf,
|
||||||
ScreenWidthActual, ScreenHeightActual))
|
ScreenWidthActual, ScreenHeightActual))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|||||||
@@ -212,4 +212,28 @@ TFB_SupportsHardwareScaling (void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SDL_Surface *
|
||||||
|
Create_Screen (SDL_Surface *templat, int w, int h)
|
||||||
|
{
|
||||||
|
SDL_Surface *newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h
|
||||||
|
templat->format->BitsPerPixel,
|
||||||
|
templat->format->Rmask, templat->format->GMask,
|
||||||
|
templat->format->Bmask, 0);
|
||||||
|
if (newsurf == 0) {
|
||||||
|
log_add (log_Error, "Couldn't create screen buffes: %s",
|
||||||
|
SDL_GetError());
|
||||||
|
}
|
||||||
|
return newsurf;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL1_ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h)
|
||||||
|
{
|
||||||
|
if (*screen) {
|
||||||
|
SDL_FreeSurface (*screen);
|
||||||
|
}
|
||||||
|
*screen = Create_Screen (templat, w, h);
|
||||||
|
|
||||||
|
return *screen == 0 ? -1 : 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -55,8 +55,9 @@ int TFB_SetColorKey (SDL_Surface *surface, Uint32 key, int rleaccel);
|
|||||||
int TFB_DisableColorKey (SDL_Surface *surface);
|
int TFB_DisableColorKey (SDL_Surface *surface);
|
||||||
int TFB_SetColors (SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);
|
int TFB_SetColors (SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);
|
||||||
|
|
||||||
SDL_Surface* Create_Screen (SDL_Surface *templat, int w, int h);
|
#if SDL_MAJOR_VERSION == 1
|
||||||
int ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h);
|
int SDL1_ReInit_Screen (SDL_Surface **screen, SDL_Surface *templat, int w, int h);
|
||||||
|
#endif
|
||||||
void UnInit_Screen (SDL_Surface **screen);
|
void UnInit_Screen (SDL_Surface **screen);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user