Fixed bug 4669: Android software renderer, black screen when window resizes Using the software SDL_Renderer on Android leads to GL errors & black screen when window resizes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c
index a4a2e1c..81d7fd4 100644
--- a/src/core/android/SDL_android.c
+++ b/src/core/android/SDL_android.c
@@ -732,7 +732,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)(
if (Android_Window)
{
- Android_SendResize(Android_Window);
+ Android_send_resize = 1;
}
SDL_UnlockMutex(Android_ActivityMutex);
diff --git a/src/video/android/SDL_androidevents.c b/src/video/android/SDL_androidevents.c
index de560c9..b0f00c0 100644
--- a/src/video/android/SDL_androidevents.c
+++ b/src/video/android/SDL_androidevents.c
@@ -66,6 +66,11 @@ android_egl_context_restore(SDL_Window *window)
event.type = SDL_RENDER_DEVICE_RESET;
SDL_PushEvent(&event);
}
+
+ if (Android_send_resize) {
+ Android_send_resize = 0;
+ Android_SendResize(window);
+ }
}
}
diff --git a/src/video/android/SDL_androidvideo.c b/src/video/android/SDL_androidvideo.c
index 91e6e99..41c4bde 100644
--- a/src/video/android/SDL_androidvideo.c
+++ b/src/video/android/SDL_androidvideo.c
@@ -69,6 +69,7 @@ static int Android_ScreenRate = 0;
SDL_sem *Android_PauseSem = NULL;
SDL_sem *Android_ResumeSem = NULL;
SDL_mutex *Android_ActivityMutex = NULL;
+int Android_send_resize = 0;
static int
Android_Available(void)
diff --git a/src/video/android/SDL_androidvideo.h b/src/video/android/SDL_androidvideo.h
index ef90996..4ee6d69 100644
--- a/src/video/android/SDL_androidvideo.h
+++ b/src/video/android/SDL_androidvideo.h
@@ -44,6 +44,7 @@ extern int Android_SurfaceWidth;
extern int Android_SurfaceHeight;
extern SDL_sem *Android_PauseSem, *Android_ResumeSem;
extern SDL_mutex *Android_ActivityMutex;
+extern int Android_send_resize;
#endif /* SDL_androidvideo_h_ */