Fixed incoherent logic in SDL_Surface pitch calculation
This commit is contained in:
@@ -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);
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user