(Android) Move video reinit code to EGL check_window function -

now properly resizes video after orientation change and restores
video context after minimizing and restoring
This commit is contained in:
twinaphex 2012-12-05 06:17:45 +01:00
parent b2cd86c047
commit 0dce6a6db6
2 changed files with 19 additions and 18 deletions

View File

@ -395,10 +395,11 @@ static void* android_app_entry(void* param)
g_android.input_state |= (1ULL << RARCH_QUIT_KEY);
g_android.input_state |= (1ULL << RARCH_KILL);
}
else
RARCH_LOG("Initializing succeeded.\n");
if (init_ret == 0)
{
RARCH_LOG("Initializing succeeded.\n");
RARCH_LOG("RetroArch started.\n");
rarch_init_msg_queue();
g_android.last_orient = AConfiguration_getOrientation(android_app->config);
@ -407,24 +408,7 @@ static void* android_app_entry(void* param)
while(g_android.activity_paused)
{
if(!android_run_events(android_app))
{
goto exit;
}
}
if (g_android.reinit_video)
{
uninit_drivers();
init_drivers();
g_android.reinit_video = 0;
}
if (AConfiguration_getOrientation(android_app->config) != g_android.last_orient)
{
// reinit video driver for new window dimensions
driver.video->free(driver.video_data);
init_video_input();
g_android.last_orient = AConfiguration_getOrientation(android_app->config);
}
}
RARCH_LOG("RetroArch stopped.\n");

View File

@ -207,6 +207,23 @@ static void gfx_ctx_check_window(bool *quit,
*quit = false;
*resize = false;
if (g_android.reinit_video)
{
uninit_drivers();
init_drivers();
g_android.reinit_video = 0;
*resize = true;
}
if (AConfiguration_getOrientation(g_android.app->config) != g_android.last_orient)
{
*resize = true;
// reinit video driver for new window dimensions
driver.video->free(driver.video_data);
init_video_input();
g_android.last_orient = AConfiguration_getOrientation(g_android.app->config);
}
// Check if we are exiting.
if (g_android.app->destroyRequested != 0 || (g_android.input_state & (1ULL << RARCH_KILL)))
*quit = true;