aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/platform/android/android.cpp9
-rw-r--r--backends/platform/android/android.h10
-rw-r--r--backends/platform/android/gfx.cpp48
3 files changed, 47 insertions, 20 deletions
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 85d4817f29..7731c53873 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -438,10 +438,7 @@ bool OSystem_Android::pollEvent(Common::Event &event) {
updateScreenRect();
// double buffered, flip twice
- _force_redraw = true;
- updateScreen();
- _force_redraw = true;
- updateScreen();
+ clearScreen(kClearUpdate, 2);
event.type = Common::EVENT_SCREEN_CHANGED;
@@ -451,8 +448,8 @@ bool OSystem_Android::pollEvent(Common::Event &event) {
initSurface();
updateScreenRect();
- _force_redraw = true;
- updateScreen();
+ // double buffered, flip twice
+ clearScreen(kClearUpdate, 2);
event.type = Common::EVENT_SCREEN_CHANGED;
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 8e6d72fad2..db2cb95650 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -186,7 +186,15 @@ public:
virtual void initSize(uint width, uint height,
const Graphics::PixelFormat *format);
- void clearScreen(bool swapBuffers);
+
+ enum FixupType {
+ kClear = 0, // glClear
+ kClearSwap, // glClear + swapBuffers
+ kClearUpdate // glClear + updateScreen
+ };
+
+ void clearScreen(FixupType type, byte count = 1);
+
void updateScreenRect();
virtual int getScreenChangeID() const;
diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp
index 83ee8ba0f0..191d82efad 100644
--- a/backends/platform/android/gfx.cpp
+++ b/backends/platform/android/gfx.cpp
@@ -278,26 +278,47 @@ void OSystem_Android::initSize(uint width, uint height,
// size (it's small).
_mouse_texture_palette->allocBuffer(20, 20);
- clearScreen(true);
+ clearScreen(kClear);
}
-void OSystem_Android::clearScreen(bool swapBuffers) {
- // clear screen
- GLCALL(glClearColorx(0, 0, 0, 1 << 16));
- GLCALL(glClear(GL_COLOR_BUFFER_BIT));
+void OSystem_Android::clearScreen(FixupType type, byte count) {
+ assert(count > 0);
- if (swapBuffers)
- JNI::swapBuffers();
+ for (byte i = 0; i < count; ++i) {
+ if (!_show_overlay)
+ GLCALL(glDisable(GL_SCISSOR_TEST));
+
+ // clear screen
+ GLCALL(glClearColorx(0, 0, 0, 1 << 16));
+ GLCALL(glClear(GL_COLOR_BUFFER_BIT));
+
+ if (!_show_overlay)
+ GLCALL(glEnable(GL_SCISSOR_TEST));
+
+ switch (type) {
+ case kClear:
+ break;
+
+ case kClearSwap:
+ JNI::swapBuffers();
+ break;
+
+ case kClearUpdate:
+ _force_redraw = true;
+ updateScreen();
+ break;
+ }
+ }
}
void OSystem_Android::updateScreenRect() {
- uint16 w = _game_texture->width();
- uint16 h = _game_texture->height();
-
Common::Rect rect(0, 0, _egl_surface_width, _egl_surface_height);
_overlay_texture->setDrawRect(rect);
+ uint16 w = _game_texture->width();
+ uint16 h = _game_texture->height();
+
if (w && h && !_fullscreen) {
if (_ar_correction && w == 320 && h == 200)
h = 240;
@@ -404,7 +425,7 @@ void OSystem_Android::updateScreen() {
// clear pointer leftovers in dead areas
if (_show_overlay && !_fullscreen)
- clearScreen(false);
+ clearScreen(kClear);
GLCALL(glPushMatrix());
@@ -414,7 +435,7 @@ void OSystem_Android::updateScreen() {
_game_texture->height()).contains(_focus_rect))) {
// These are the only cases where _game_texture doesn't
// cover the entire screen.
- clearScreen(false);
+ clearScreen(kClear);
// Move everything up by _shake_offset (game) pixels
GLCALL(glTranslatex(0, -_shake_offset << 16, 0));
@@ -574,7 +595,8 @@ void OSystem_Android::hideOverlay() {
_show_overlay = false;
_force_redraw = true;
- clearScreen(false);
+ // double buffered, flip twice
+ clearScreen(kClearUpdate, 2);
GLCALL(glEnable(GL_SCISSOR_TEST));
}