Skip to content

Commit

Permalink
ANDROID: Move the overlay initialization
Browse files Browse the repository at this point in the history
There's no point in doing that in initSize() every time
  • Loading branch information
dhewg committed Mar 7, 2011
1 parent 920bae6 commit e71fb5b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions backends/platform/android/android.cpp
Expand Up @@ -333,6 +333,8 @@ void OSystem_Android::initBackend() {
_mouse_texture_palette = new GLESPalette8888Texture();
_mouse_texture = _mouse_texture_palette;

initOverlay();

// renice this thread to boost the audio thread
if (setpriority(PRIO_PROCESS, 0, 19) < 0)
warning("couldn't renice the main thread");
Expand Down
2 changes: 2 additions & 0 deletions backends/platform/android/android.h
Expand Up @@ -146,6 +146,8 @@ class OSystem_Android : public BaseBackend, public PaletteManager {
void deinitSurface();
void initViewport();

void initOverlay();

#ifdef USE_RGB_COLOR
Common::String getPixelFormatName(const Graphics::PixelFormat &format) const;
void initTexture(GLESTexture **texture, uint width, uint height,
Expand Down
18 changes: 11 additions & 7 deletions backends/platform/android/gfx.cpp
Expand Up @@ -169,8 +169,10 @@ void OSystem_Android::initSurface() {
if (_game_texture)
_game_texture->reinit();

if (_overlay_texture)
if (_overlay_texture) {
_overlay_texture->reinit();
initOverlay();
}

if (_mouse_texture)
_mouse_texture->reinit();
Expand Down Expand Up @@ -233,12 +235,7 @@ void OSystem_Android::initViewport() {
clearFocusRectangle();
}

void OSystem_Android::initSize(uint width, uint height,
const Graphics::PixelFormat *format) {
ENTER("%d, %d, %p", width, height, format);

GLTHREADCHECK;

void OSystem_Android::initOverlay() {
int overlay_width = _egl_surface_width;
int overlay_height = _egl_surface_height;

Expand All @@ -256,6 +253,13 @@ void OSystem_Android::initSize(uint width, uint height,
LOGI("overlay size is %ux%u", overlay_width, overlay_height);

_overlay_texture->allocBuffer(overlay_width, overlay_height);
}

void OSystem_Android::initSize(uint width, uint height,
const Graphics::PixelFormat *format) {
ENTER("%d, %d, %p", width, height, format);

GLTHREADCHECK;

#ifdef USE_RGB_COLOR
initTexture(&_game_texture, width, height, format, false);
Expand Down

0 comments on commit e71fb5b

Please sign in to comment.