Wii: Work around a performance regression caused by r4080. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4819 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-12-17 13:01:13 +00:00
parent 8ec58a208d
commit bd813831b0
2 changed files with 25 additions and 0 deletions

View file

@ -40,6 +40,9 @@
#ifdef __ANDROID__ #ifdef __ANDROID__
#include <android/log.h> #include <android/log.h>
#endif #endif
#if defined GEKKO
# define SDL_DISABLE_8BIT_BUFFER
#endif
#if !defined STARTUP_SETUP_WINDOW #if !defined STARTUP_SETUP_WINDOW
int32_t startwin_open(void) { return 0; } int32_t startwin_open(void) { return 0; }
@ -66,7 +69,11 @@ char quitevent=0, appactive=1, novideo=0;
// video // video
static SDL_Surface *sdl_surface/*=NULL*/; static SDL_Surface *sdl_surface/*=NULL*/;
#if !defined SDL_DISABLE_8BIT_BUFFER
static SDL_Surface *sdl_buffersurface=NULL; static SDL_Surface *sdl_buffersurface=NULL;
#else
# define sdl_buffersurface sdl_surface
#endif
#if SDL_MAJOR_VERSION==2 #if SDL_MAJOR_VERSION==2
static SDL_Palette *sdl_palptr=NULL; static SDL_Palette *sdl_palptr=NULL;
@ -1139,10 +1146,12 @@ static SDL_Color sdlayer_pal[256];
static void destroy_window_resources() static void destroy_window_resources()
{ {
#if !defined SDL_DISABLE_8BIT_BUFFER
if (sdl_buffersurface) if (sdl_buffersurface)
SDL_FreeSurface(sdl_buffersurface); SDL_FreeSurface(sdl_buffersurface);
sdl_buffersurface = NULL; sdl_buffersurface = NULL;
#endif
/* We should NOT destroy the window surface. This is done automatically /* We should NOT destroy the window surface. This is done automatically
when SDL_DestroyWindow or SDL_SetVideoMode is called. */ when SDL_DestroyWindow or SDL_SetVideoMode is called. */
@ -1455,10 +1464,12 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
SDL2_VIDEO_ERR("SDL_GetWindowSurface"); SDL2_VIDEO_ERR("SDL_GetWindowSurface");
} }
#if !defined SDL_DISABLE_8BIT_BUFFER
sdl_buffersurface = SDL_CreateRGBSurface(0, x, y, c, 0, 0, 0, 0); sdl_buffersurface = SDL_CreateRGBSurface(0, x, y, c, 0, 0, 0, 0);
if (!sdl_buffersurface) if (!sdl_buffersurface)
SDL2_VIDEO_ERR("SDL_CreateRGBSurface"); SDL2_VIDEO_ERR("SDL_CreateRGBSurface");
#endif
if (!sdl_palptr) if (!sdl_palptr)
sdl_palptr = SDL_AllocPalette(256); sdl_palptr = SDL_AllocPalette(256);
@ -1574,7 +1585,9 @@ void showframe(int32_t w)
needpalupdate = 0; needpalupdate = 0;
} }
#if !defined SDL_DISABLE_8BIT_BUFFER
SDL_BlitSurface(sdl_buffersurface, NULL, sdl_surface, NULL); SDL_BlitSurface(sdl_buffersurface, NULL, sdl_surface, NULL);
#endif
if (sdl_renderer && sdl_texture) if (sdl_renderer && sdl_texture)
{ {

View file

@ -267,8 +267,12 @@ void getvalidmodes(void)
pf.BitsPerPixel = cdepths[j]; pf.BitsPerPixel = cdepths[j];
pf.BytesPerPixel = cdepths[j] >> 3; pf.BytesPerPixel = cdepths[j] >> 3;
#if !defined SDL_DISABLE_8BIT_BUFFER
// We convert paletted contents to non-paletted // We convert paletted contents to non-paletted
modes = SDL_ListModes((cdepths[j] == 8) ? NULL : &pf, SURFACE_FLAGS | SDL_FULLSCREEN); modes = SDL_ListModes((cdepths[j] == 8) ? NULL : &pf, SURFACE_FLAGS | SDL_FULLSCREEN);
#else
modes = SDL_ListModes(&pf, SURFACE_FLAGS | SDL_FULLSCREEN);
#endif
if (modes == (SDL_Rect **)0) if (modes == (SDL_Rect **)0)
{ {
@ -409,19 +413,25 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
else else
#endif // defined USE_OPENGL #endif // defined USE_OPENGL
{ {
#if !defined SDL_DISABLE_8BIT_BUFFER
// We convert paletted contents to non-paletted // We convert paletted contents to non-paletted
sdl_surface = SDL_SetVideoMode(x, y, 0, SURFACE_FLAGS | ((fs & 1) ? SDL_FULLSCREEN : 0)); sdl_surface = SDL_SetVideoMode(x, y, 0, SURFACE_FLAGS | ((fs & 1) ? SDL_FULLSCREEN : 0));
#else
sdl_surface = SDL_SetVideoMode(x, y, c, SURFACE_FLAGS | ((fs & 1) ? SDL_FULLSCREEN : 0));
#endif
if (!sdl_surface) if (!sdl_surface)
{ {
initprintf("Unable to set video mode!\n"); initprintf("Unable to set video mode!\n");
return -1; return -1;
} }
#if !defined SDL_DISABLE_8BIT_BUFFER
sdl_buffersurface = SDL_CreateRGBSurface(SURFACE_FLAGS, x, y, c, 0, 0, 0, 0); sdl_buffersurface = SDL_CreateRGBSurface(SURFACE_FLAGS, x, y, c, 0, 0, 0, 0);
if (!sdl_buffersurface) if (!sdl_buffersurface)
{ {
initprintf("Unable to set video mode: SDL_CreateRGBSurface failed: %s\n", SDL_GetError()); initprintf("Unable to set video mode: SDL_CreateRGBSurface failed: %s\n", SDL_GetError());
return -1; return -1;
} }
#endif
} }
setvideomode_sdlcommonpost(x, y, c, fs, regrab); setvideomode_sdlcommonpost(x, y, c, fs, regrab);
@ -462,7 +472,9 @@ void showframe(int32_t w)
needpalupdate = 0; needpalupdate = 0;
} }
#if !defined SDL_DISABLE_8BIT_BUFFER
SDL_BlitSurface(sdl_buffersurface, NULL, sdl_surface, NULL); SDL_BlitSurface(sdl_buffersurface, NULL, sdl_surface, NULL);
#endif
SDL_Flip(sdl_surface); SDL_Flip(sdl_surface);
} }