aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android/gfx.cpp
diff options
context:
space:
mode:
authordhewg2011-02-27 20:13:48 +0100
committerdhewg2011-03-02 23:18:34 +0100
commit2333a32697cda8f5f73861856889001839f38f25 (patch)
tree048a743c33bdcf2f508fd031556abd1079d735c6 /backends/platform/android/gfx.cpp
parentb84b56b2481bac8ad92ffe6870b28b288011bf6a (diff)
downloadscummvm-rg350-2333a32697cda8f5f73861856889001839f38f25.tar.gz
scummvm-rg350-2333a32697cda8f5f73861856889001839f38f25.tar.bz2
scummvm-rg350-2333a32697cda8f5f73861856889001839f38f25.zip
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
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
}
}