The total size in bytes is calculated by multiplying the stride by the height, not the width. This is because the stride represents the number of bytes in a row of pixels, and there are height number of rows in the bitmap. So to calculate the total size of the buffer, you need to multiply the stride by the height, not the width.
The total size in bytes is calculated by multiplying the stride by the height, not the width. This is because the stride represents the number of bytes in a row of pixels, and there are height number of rows in the bitmap. So to calculate the total size of the buffer, you need to multiply the stride by the height, not the width.