aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordhewg2011-04-03 20:26:27 +0200
committerdhewg2011-04-03 20:34:24 +0200
commitea4223d941ec9dcbcca0530ed633cf8b5d05be40 (patch)
tree7c368c987361763a8283af43695aa225d785940a
parentfba1c6360c0194e5cad6133dc312c1c8ae80ac39 (diff)
downloadscummvm-rg350-ea4223d941ec9dcbcca0530ed633cf8b5d05be40.tar.gz
scummvm-rg350-ea4223d941ec9dcbcca0530ed633cf8b5d05be40.tar.bz2
scummvm-rg350-ea4223d941ec9dcbcca0530ed633cf8b5d05be40.zip
ANDROID: Always use the surface size for the overlay
When coming back from standby, there might be an indermediate surface change
-rw-r--r--backends/platform/android/events.cpp36
-rw-r--r--backends/platform/android/gfx.cpp8
2 files changed, 15 insertions, 29 deletions
diff --git a/backends/platform/android/events.cpp b/backends/platform/android/events.cpp
index 2576287a83..ccb18dde89 100644
--- a/backends/platform/android/events.cpp
+++ b/backends/platform/android/events.cpp
@@ -696,35 +696,19 @@ bool OSystem_Android::pollEvent(Common::Event &event) {
if (pthread_self() == _main_thread) {
if (_screen_changeid != JNI::surface_changeid) {
if (JNI::egl_surface_width > 0 && JNI::egl_surface_height > 0) {
- if (_egl_surface_width > 0 && _egl_surface_height > 0) {
- // surface still alive but changed
- _screen_changeid = JNI::surface_changeid;
- _egl_surface_width = JNI::egl_surface_width;
- _egl_surface_height = JNI::egl_surface_height;
+ // surface changed
+ JNI::deinitSurface();
+ initSurface();
+ initViewport();
+ updateScreenRect();
+ updateEventScale();
- initViewport();
- updateScreenRect();
- updateEventScale();
+ // double buffered, flip twice
+ clearScreen(kClearUpdate, 2);
- // double buffered, flip twice
- clearScreen(kClearUpdate, 2);
+ event.type = Common::EVENT_SCREEN_CHANGED;
- event.type = Common::EVENT_SCREEN_CHANGED;
-
- return true;
- } else {
- // new surface
- initSurface();
- updateScreenRect();
- updateEventScale();
-
- // double buffered, flip twice
- clearScreen(kClearUpdate, 2);
-
- event.type = Common::EVENT_SCREEN_CHANGED;
-
- return true;
- }
+ return true;
} else {
// surface lost
deinitSurface();
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index ab7240e648..b2f5427f01 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -235,8 +235,10 @@ void OSystem_Android::initViewport() {
}
void OSystem_Android::initOverlay() {
- int overlay_width = _egl_surface_width;
- int overlay_height = _egl_surface_height;
+ // minimum of 320x200
+ // (surface can get smaller when opening the virtual keyboard on *QVGA*)
+ int overlay_width = MAX(_egl_surface_width, 320);
+ int overlay_height = MAX(_egl_surface_height, 200);
// the 'normal' theme layout uses a max height of 400 pixels. if the
// surface is too big we use only a quarter of the size so that the widgets
@@ -244,7 +246,7 @@ void OSystem_Android::initOverlay() {
// enforces the 'lowres' layout, which will be scaled back up by factor 2x,
// but this looks way better than the 'normal' layout scaled by some
// calculated factors
- if (overlay_height > 480) {
+ while (overlay_height > 480) {
overlay_width /= 2;
overlay_height /= 2;
}