It's possible that this size alignment is necessary though. Why are
you using it instead of just using w * h * (bpp / 8)?
It's just for the 4 byte aligned in some cases. And if the size exceeds/doesn't match then it's not really an issue for testing purposes atleast. I try using w * h * (bpp/8) if you want though.