AndEngine
AndEngine copied to clipboard
getTextureMemorySize calculation is wrong
On Texture.java:
@Override
public int getTextureMemorySize() {
final int pixelCount = this.getWidth() * this.getHeight();
final int bytesPerPixel = this.mPixelFormat.getBitsPerPixel() * DataConstants.BITS_PER_BYTE;
return pixelCount * bytesPerPixel / DataConstants.BYTES_PER_KILOBYTE;
}
I believe the line
final int bytesPerPixel = this.mPixelFormat.getBitsPerPixel() * DataConstants.BITS_PER_BYTE;
should have been
final int bytesPerPixel = this.mPixelFormat.getBitsPerPixel() / DataConstants.BITS_PER_BYTE;
This gives me the correct result when calling TextureManager#getTextureMemoryUsed().
Ooops.... Can you file a PR for that? Thanks!