From fcf929aa2f95e4956cbca4574870c0a507ac6cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Tue, 12 Aug 2014 13:21:13 -0300 Subject: [PATCH 1/2] (SDL2) Properly deinitialize the video driver --- gfx/sdl2_gfx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gfx/sdl2_gfx.c b/gfx/sdl2_gfx.c index 7a1c56a17a..c9a67d4c78 100644 --- a/gfx/sdl2_gfx.c +++ b/gfx/sdl2_gfx.c @@ -568,6 +568,12 @@ static void sdl2_gfx_free(void *data) if (!vid) return; + if (vid->renderer) + SDL_DestroyRenderer(vid->renderer); + + if (vid->window) + SDL_DestroyWindow(vid->window); + SDL_QuitSubSystem(SDL_INIT_VIDEO); if (vid->font_data) From 472c58e4865985c556d523af01f9011a92a052b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Tue, 12 Aug 2014 15:58:10 -0300 Subject: [PATCH 2/2] (SDL2) Fix wrong aspect ratio on startup --- gfx/sdl2_gfx.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/gfx/sdl2_gfx.c b/gfx/sdl2_gfx.c index c9a67d4c78..5907525082 100644 --- a/gfx/sdl2_gfx.c +++ b/gfx/sdl2_gfx.c @@ -327,24 +327,8 @@ static void sdl_refresh_input_size(sdl2_video_t *vid, bool menu, bool rgb32, if (menu) format = rgb32 ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_RGBA4444; - else - { - switch (g_extern.system.pix_fmt) - { - case RETRO_PIXEL_FORMAT_XRGB8888: - format = SDL_PIXELFORMAT_ARGB8888; - break; - case RETRO_PIXEL_FORMAT_0RGB1555: - /* this assumes the frontend will convert the input to RGB565 */ - case RETRO_PIXEL_FORMAT_RGB565: - format = SDL_PIXELFORMAT_RGB565; - break; - default: - RARCH_ERR("Unknown/unsupported video format.\n"); - return; - break; - } - } + else /* this assumes the frontend will convert 0RGB1555 to RGB565 */ + format = rgb32 ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_RGB565; SDL_SetHintWithPriority(SDL_HINT_RENDER_SCALE_QUALITY, (vid->video.smooth || menu) ? "linear" : "nearest", @@ -436,6 +420,7 @@ static void *sdl2_gfx_init(const video_info_t *video, const input_driver_t **inp goto error; } + vid->video = *video; vid->video.smooth = g_settings.video.smooth; vid->should_resize = true; @@ -506,7 +491,7 @@ static bool sdl2_gfx_frame(void *data, const void *frame, unsigned width, if (frame) { - sdl_refresh_input_size(vid, false, vid->frame.rgb32/*vid->video.rgb32*/, width, height, pitch); + sdl_refresh_input_size(vid, false, vid->video.rgb32, width, height, pitch); RARCH_PERFORMANCE_INIT(sdl_copy_frame); RARCH_PERFORMANCE_START(sdl_copy_frame);