diff options
author | dhewg | 2011-03-13 16:37:56 +0100 |
---|---|---|
committer | dhewg | 2011-03-13 16:50:48 +0100 |
commit | fa51d82639a500939907fdc9d18497914c60fe2c (patch) | |
tree | 932c262c11a68e825cd81299d0ada4b4c3d1978e /backends/platform/android | |
parent | 2721e287e5bcd1f4d524f869c26156e27f5ba187 (diff) | |
download | scummvm-rg350-fa51d82639a500939907fdc9d18497914c60fe2c.tar.gz scummvm-rg350-fa51d82639a500939907fdc9d18497914c60fe2c.tar.bz2 scummvm-rg350-fa51d82639a500939907fdc9d18497914c60fe2c.zip |
ANDROID: Prevent unnecessary reallocs
Diffstat (limited to 'backends/platform/android')
-rw-r--r-- | backends/platform/android/texture.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index a20222ec64..c309bd51b4 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -218,8 +218,14 @@ GLESTexture::~GLESTexture() { } void GLESTexture::allocBuffer(GLuint w, GLuint h) { + GLuint oldw = _surface.w; + GLuint oldh = _surface.h; + GLESBaseTexture::allocBuffer(w, h); + if (_surface.w == oldw && _surface.h == oldh) + return; + delete[] _buf; delete[] _pixels; @@ -341,9 +347,13 @@ GLESPaletteTexture::~GLESPaletteTexture() { } void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) { + GLuint oldw = _surface.w; + GLuint oldh = _surface.h; + GLESBaseTexture::allocBuffer(w, h); - // Texture gets uploaded later (from drawTexture()) + if (_surface.w == oldw && _surface.h == oldh) + return; byte *new_buffer = new byte[_paletteSize + _texture_width * _texture_height]; @@ -457,8 +467,14 @@ GLESFakePaletteTexture::~GLESFakePaletteTexture() { } void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) { + GLuint oldw = _surface.w; + GLuint oldh = _surface.h; + GLESBaseTexture::allocBuffer(w, h); + if (_surface.w == oldw && _surface.h == oldh) + return; + delete[] _buf; delete[] _pixels; |