From b4a6c89662700b448db41d1e0c99cdf39a2dc5e0 Mon Sep 17 00:00:00 2001 From: dhewg Date: Fri, 25 Mar 2011 00:35:47 +0100 Subject: ANDROID: Always set the surface properties Didn't happen on the shortcut, which led to wrong properties and surface functions scribbling over memory --- backends/platform/android/texture.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/android/texture.cpp b/backends/platform/android/texture.cpp index 407ba0419d..573f8f83e1 100644 --- a/backends/platform/android/texture.cpp +++ b/backends/platform/android/texture.cpp @@ -231,6 +231,8 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) { GLESBaseTexture::allocBuffer(w, h); + _surface.pitch = w * _pixelFormat.bytesPerPixel; + if (_surface.w == oldw && _surface.h == oldh) { fillBuffer(0); return; @@ -243,7 +245,6 @@ void GLESTexture::allocBuffer(GLuint w, GLuint h) { assert(_pixels); _surface.pixels = _pixels; - _surface.pitch = w * _pixelFormat.bytesPerPixel; fillBuffer(0); @@ -364,6 +365,8 @@ void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) { GLESBaseTexture::allocBuffer(w, h); + _surface.pitch = _texture_width; + if (_surface.w == oldw && _surface.h == oldh) { fillBuffer(0); return; @@ -375,7 +378,6 @@ void GLESPaletteTexture::allocBuffer(GLuint w, GLuint h) { assert(_texture); _surface.pixels = _texture + _paletteSize; - _surface.pitch = _texture_width; fillBuffer(0); @@ -490,6 +492,9 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) { GLESBaseTexture::allocBuffer(w, h); + _surface.bytesPerPixel = 1; + _surface.pitch = w; + if (_surface.w == oldw && _surface.h == oldh) { fillBuffer(0); return; @@ -503,8 +508,6 @@ void GLESFakePaletteTexture::allocBuffer(GLuint w, GLuint h) { // fixup surface, for the outside this is a CLUT8 surface _surface.pixels = _pixels; - _surface.bytesPerPixel = 1; - _surface.pitch = w; fillBuffer(0); -- cgit v1.2.3