[SDL] Surface Pitch inconsistencies?

Dave Ashley (SDL list) sdl at xdr.com
Mon Aug 16 18:05:59 PDT 1999

>	OK I'll admit this is probably a silly question and results from
>	the fact that I really don't understand what pitch is completely
>	but this is just confusing the heck out of me. I am writing a
>	game that can run in both windowed and fullscreen mode at
>	640x480x16. Now when I am in a window My Resolution is 640x480
>	and my bytes per pixel is 2 making my pitch 1280 (which makes
>	since since I thought that pitch was width of the screen in
>	bytes which is 640 pixels times 2 bytes per pixel.) However,
>	when I run in fullscreen mode at 640x480 My bytes per pixel is
>	still 2 but my pitch seems to magically be 2560. (This makes
>	absolutely no sense to me since I wouldn't expect the pitch to
>	change. Shouldn't it still be 640*2? Why is it all of the sudden
>	640*4?

Why do you care? Does the display work? That's all that matters, isn't it?

The mere existence of a pitch variable implies that the # of bytes between
successive rows is unpredictable. So, just use the pitch as intended, and
get on with your life :^).


More information about the SDL mailing list