iteration sped up somewhat by scanline flags