diff --git a/project/jni/sdl-1.2/src/video/SDL_pixels.c b/project/jni/sdl-1.2/src/video/SDL_pixels.c index abfa36825..02a6e406d 100644 --- a/project/jni/sdl-1.2/src/video/SDL_pixels.c +++ b/project/jni/sdl-1.2/src/video/SDL_pixels.c @@ -304,11 +304,12 @@ Uint16 SDL_CalculatePitch(SDL_Surface *surface) default: break; } -// 4-byte aligning adds extra memcpy() with OpenGL ES renderer -// TODO: check if we really can disable that for Android -#ifndef ANDROID - pitch = (pitch + 3) & ~3; /* 4-byte aligning */ + +#ifdef ANDROID + if( surface->format->BytesPerPixel != 2 ) /* Avoid extra memcpy() when updating GLES textures */ #endif + pitch = (pitch + 3) & ~3; /* 4-byte aligning */ + return(pitch); } /* diff --git a/project/jni/sdl-1.3/src/video/SDL_pixels.c b/project/jni/sdl-1.3/src/video/SDL_pixels.c index 3ada76536..53be93d2f 100644 --- a/project/jni/sdl-1.3/src/video/SDL_pixels.c +++ b/project/jni/sdl-1.3/src/video/SDL_pixels.c @@ -583,6 +583,9 @@ SDL_CalculatePitch(SDL_Surface * surface) default: break; } +#ifdef ANDROID + if( surface->format->BytesPerPixel != 2 ) /* Avoid extra memcpy() when calling SDL_UpdateTexture() */ +#endif pitch = (pitch + 3) & ~3; /* 4-byte aligning */ return (pitch); }