Fixed incoherent logic in SDL_Surface pitch calculation

This commit is contained in:
pelya
2010-10-18 12:28:05 +03:00
parent bd185f68b1
commit 6986ee8084
2 changed files with 8 additions and 4 deletions

View File

@@ -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);
}
/*

View File

@@ -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);
}