jennschiffer/make8bitart — pull request #35 by tessalt (2014-11-25 13:00:15+00:00)
Title: Feature/scanline flood

Paint bucket tool was taxing my poor little macbook air :fire: :anguished: so a couple perf improvements in new `paint` function:

- instead of getting and setting colors pixel by pixel running getImageData for each checked pixel, just runs it once and grabs the whole image, then reads/writes the ImageData.data array
- uses scanline floodfill algorithm copied from http://will.thimbleby.net/scanline-flood-fill/

I need to run some proper perf tests but I think it's at least about 2x faster :speedboat:

Potential future improvement:

- I'm doing things pixel by pixel but could the algorithm work pixel.size by pixel.size maybe? At least vertically maybe. Math.

:heart: this project btw!

![screen shot 2014-11-25 at 1 26 43 am](https://cloud.githubusercontent.com/assets/1789029/5183118/e6a7ca24-7478-11e4-8267-5a3211a2d4fd.png)