diff options
author | dhewg | 2011-03-24 18:54:14 +0100 |
---|---|---|
committer | dhewg | 2011-03-24 18:56:54 +0100 |
commit | 397fd31a17f007a610aa7b673170983414efb5d5 (patch) | |
tree | 70598c3bb269dfa60bb2b18f7e956daeb1371865 /backends/platform/android/texture.cpp | |
parent | 62f5c475f3bf7482526ce58bd90f37343ef523a6 (diff) | |
download | scummvm-rg350-397fd31a17f007a610aa7b673170983414efb5d5.tar.gz scummvm-rg350-397fd31a17f007a610aa7b673170983414efb5d5.tar.bz2 scummvm-rg350-397fd31a17f007a610aa7b673170983414efb5d5.zip |
ANDROID: Cleanup
Diffstat (limited to 'backends/platform/android/texture.cpp')
-rw-r--r-- | backends/platform/android/texture.cpp | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index 691c384a18..b96d6bf443 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -229,8 +229,10 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) { GLESBaseTexture::allocBuffer(w, h); - if (_surface.w == oldw && _surface.h == oldh) + if (_surface.w == oldw && _surface.h == oldh) { + fillBuffer(0); return; + } delete[] _buf; delete[] _pixels; @@ -241,6 +243,8 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) { _surface.pixels = _pixels; _surface.pitch = w * _pixelFormat.bytesPerPixel; + fillBuffer(0); + _buf = new byte[w * h * _surface.bytesPerPixel]; assert(_buf); } @@ -358,22 +362,26 @@ void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) { GLESBaseTexture::allocBuffer(w, h); - if (_surface.w == oldw && _surface.h == oldh) + if (_surface.w == oldw && _surface.h == oldh) { + fillBuffer(0); return; + } - byte *new_buffer = new byte[_paletteSize + - _texture_width * _texture_height]; - assert(new_buffer); + byte *old_texture = _texture; - if (_texture) { - // preserve palette - memcpy(new_buffer, _texture, _paletteSize); - delete[] _texture; - } + _texture = new byte[_paletteSize + _texture_width * _texture_height]; + assert(_texture); - _texture = new_buffer; _surface.pixels = _texture + _paletteSize; _surface.pitch = _texture_width; + + fillBuffer(0); + + if (old_texture) { + // preserve palette + memcpy(_texture, old_texture, _paletteSize); + delete[] old_texture; + } } void GLESPaletteTexture::fillBuffer(uint32 color) { @@ -480,8 +488,10 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) { GLESBaseTexture::allocBuffer(w, h); - if (_surface.w == oldw && _surface.h == oldh) + if (_surface.w == oldw && _surface.h == oldh) { + fillBuffer(0); return; + } delete[] _buf; delete[] _pixels; @@ -494,6 +504,8 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) { _surface.bytesPerPixel = 1; _surface.pitch = w; + fillBuffer(0); + _buf = new uint16[w * h]; assert(_buf); } |