diff options
author | dhewg | 2011-02-22 22:36:34 +0100 |
---|---|---|
committer | dhewg | 2011-02-24 23:18:33 +0100 |
commit | 867fa2696def58300cd376d03be6755007abbe43 (patch) | |
tree | 9bc6167131fffaccc57b0e7c6a0166e2ab6b5469 /backends | |
parent | 50a682e7e1c69082735a07b2261d1c0c61ac12c9 (diff) | |
download | scummvm-rg350-867fa2696def58300cd376d03be6755007abbe43.tar.gz scummvm-rg350-867fa2696def58300cd376d03be6755007abbe43.tar.bz2 scummvm-rg350-867fa2696def58300cd376d03be6755007abbe43.zip |
ANDROID: Let's not do that on the stack
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/android/texture.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index b638976dc4..c5cba97dcd 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -166,9 +166,11 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, return; #if TEXSUBIMAGE_IS_EXPENSIVE - byte tmpbuf[w * h * bytesPerPixel()]; + byte *tmp = new byte[w * h * bytesPerPixel()]; + assert(tmp); + const byte *src = static_cast<const byte *>(buf); - byte *dst = tmpbuf; + byte *dst = tmp; GLuint count = h; do { @@ -178,7 +180,9 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, } while (--count); GLCALL(glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, - glFormat(), glType(), tmpbuf)); + glFormat(), glType(), tmp)); + + delete[] tmp; #else // This version avoids the intermediate copy at the expense of // repeat glTexSubImage2D calls. On some devices this is worse. @@ -194,10 +198,15 @@ void GLESTexture::updateBuffer(GLuint x, GLuint y, GLuint w, GLuint h, } void GLESTexture::fillBuffer(byte x) { - int rowbytes = _surface.w * bytesPerPixel(); - byte tmpbuf[_surface.h * rowbytes]; - memset(tmpbuf, x, _surface.h * rowbytes); - updateBuffer(0, 0, _surface.w, _surface.h, tmpbuf, rowbytes); + uint rowbytes = _surface.w * bytesPerPixel(); + + byte *tmp = new byte[_surface.h * rowbytes]; + assert(tmp); + + memset(tmp, x, _surface.h * rowbytes); + updateBuffer(0, 0, _surface.w, _surface.h, tmp, rowbytes); + + delete[] tmp; } void GLESTexture::drawTexture(GLshort x, GLshort y, GLshort w, GLshort h) { |