Fix a couple of bugs in the scanline conversion, it works now.