prettified the paintBeachline method and also optimized its behaviour for gapless drawing