inline void SDLInitVideoDisplay(void)
{
+ putenv("SDL_VIDEO_CENTERED=1");
+
/* initialize SDL video */
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
Error(ERR_EXIT, "SDL_InitSubSystem() failed: %s", SDL_GetError());
void SDLZoomBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap)
{
+ SDL_Surface *sdl_surface_tmp;
int dst_width = dst_bitmap->width;
int dst_height = dst_bitmap->height;
+ /* throw away old destination surface */
SDL_FreeSurface(dst_bitmap->surface);
- dst_bitmap->surface = zoomSurface(src_bitmap->surface, dst_width,dst_height);
+ /* create zoomed temporary surface from source surface */
+ sdl_surface_tmp = zoomSurface(src_bitmap->surface, dst_width, dst_height);
+
+ /* create native format destination surface from zoomed temporary surface */
+ dst_bitmap->surface = SDL_DisplayFormat(sdl_surface_tmp);
+
+ /* free temporary surface */
+ SDL_FreeSurface(sdl_surface_tmp);
}
inline void SDLOpenAudio(void)
{
+ if (strcmp(setup.system.sdl_audiodriver, ARG_DEFAULT) != 0)
+ putenv(getStringCat2("SDL_AUDIODRIVER=", setup.system.sdl_audiodriver));
+
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
{
Error(ERR_WARN, "SDL_InitSubSystem() failed: %s", SDL_GetError());
if (Mix_OpenAudio(DEFAULT_AUDIO_SAMPLE_RATE, MIX_DEFAULT_FORMAT,
AUDIO_NUM_CHANNELS_STEREO,
- DEFAULT_AUDIO_FRAGMENT_SIZE) < 0)
+ setup.system.audio_fragment_size) < 0)
{
Error(ERR_WARN, "Mix_OpenAudio() failed: %s", SDL_GetError());
return;