Windows screenshot bitmap size

Ok, I am looking at this article on screenshotting:
http://msdn.microsoft.com/en-us/library/dd183402%28v=vs.85%29.aspx

For the size of the bmp, they use:
 
DWORD dwBmpSize = ((bmpScreen.bmWidth * bi.biBitCount + 31) / 32) * 4 * bmpScreen.bmHeight;


Why do they add 31 to the width*bits?
Last edited on
Why do they add 31 to the width*bits?

Rather, why do they add 31 and then divide by 32...

Where X and N are C++ integral values...

((X + (N - 1)) / N) * N rounds up to the nearest N

And there are 8 bits in a Byte

Does that help in any way?

Andy
Last edited on
ahh, yep thanks
Topic archived. No new replies allowed.