Check dimensions better when in windowed mode

Window dimensions need to be an even number of pixels. Several other
minor optimizations to the video code as well.