Made some optimization changes to gfx_sdl.