From 2333a32697cda8f5f73861856889001839f38f25 Mon Sep 17 00:00:00 2001 From: dhewg Date: Sun, 27 Feb 2011 20:13:48 +0100 Subject: ANDROID: Untangle JNI interweaving - make the startup sequence more linear - use SurfaceHolder events - get rid of the surface lock - remove unnecessary JNI calls - make the ScummVM class implement Runnable - cleanup --- backends/platform/android/gfx.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'backends/platform/android/gfx.cpp') 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 } } -- cgit v1.2.3