Fixed and optimized floodfill

Turns out flood fill was totally broke, didn't see it because default document is square. Making PR just to get the fix in.
Also went and quickly implemented an IntStack for it because it's an easy speedup.