Added compatibility mode to SDL, for misbehaving apps that don't call SDL_Flip()

This commit is contained in:
pelya
2011-07-06 11:49:01 +03:00
parent 3027c3a0ae
commit bbf90a959b
8 changed files with 80 additions and 14 deletions
@@ -1028,10 +1028,11 @@ void SDL_ANDROID_MultiThreadedVideoLoop()
{
int signalNeeded = 0;
int swapBuffersNeeded = 0;
int ret;
SDL_mutexP(videoThread.mutex);
videoThread.threadReady = 1;
SDL_CondSignal(videoThread.cond2);
SDL_CondWaitTimeout(videoThread.cond, videoThread.mutex, 1000);
ret = SDL_CondWaitTimeout(videoThread.cond, videoThread.mutex, SDL_ANDROID_CompatibilityHacks ? 400 : 1000);
if( videoThread.execute )
{
videoThread.threadReady = 0;
@@ -1059,6 +1060,11 @@ void SDL_ANDROID_MultiThreadedVideoLoop()
videoThread.execute = 0;
signalNeeded = 1;
}
else if( SDL_ANDROID_CompatibilityHacks && ret == SDL_MUTEX_TIMEDOUT && SDL_CurrentVideoSurface )
{
ANDROID_FlipHWSurfaceInternal();
swapBuffersNeeded = 1;
}
SDL_mutexV(videoThread.mutex);
if( signalNeeded )
SDL_CondSignal(videoThread.cond2);