aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android/gfx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/android/gfx.cpp')
-rw-r--r--backends/platform/android/gfx.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 8601a3bfca..49f3d40e39 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -65,8 +65,13 @@ int OSystem_Android::getGraphicsMode() const {
void OSystem_Android::setupSurface() {
ENTER();
- if (!JNI::setupSurface())
- return;
+ _screen_changeid = JNI::surface_changeid;
+ JNI::initSurface();
+
+ _egl_surface_width = JNI::egl_surface_width;
+ _egl_surface_height = JNI::egl_surface_height;
+
+ assert(_egl_surface_width > 0 && _egl_surface_height > 0);
// EGL set up with a new surface. Initialise OpenGLES context.
GLESTexture::initGLExtensions();
@@ -148,6 +153,10 @@ void OSystem_Android::initSize(uint width, uint height,
_mouse_texture->allocBuffer(20, 20);
}
+int OSystem_Android::getScreenChangeID() const {
+ return _screen_changeid;
+}
+
int16 OSystem_Android::getHeight() {
return _game_texture->height();
}
@@ -279,10 +288,14 @@ void OSystem_Android::updateScreen() {
GLCALL(glPopMatrix());
- if (!JNI::swapBuffers()) {
- // Context lost -> need to reinit GL
- JNI::destroySurface();
+ int res = JNI::swapBuffers();
+
+ if (res) {
+ warning("swapBuffers returned 0x%x", res);
+#if 0
+ JNI::initSurface();
setupSurface();
+#endif
}
}