Properly calculate surface dimension and add new fields.

  A minimal test was added to check/sdl when DEBUG is set to nonzero.