AndEngine icon indicating copy to clipboard operation
AndEngine copied to clipboard

getTextureMemorySize calculation is wrong

Open yukuku opened this issue 12 years ago • 1 comments

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().

yukuku avatar Sep 03 '13 10:09 yukuku

Ooops.... Can you file a PR for that? Thanks!

nicolasgramlich avatar Nov 15 '13 08:11 nicolasgramlich