Find the right effect faster using binary search

This must be the most ridiculous code I've written for a pull request :)

But the thing is, my system was really slowing down when using the effect number 24, because it had to test 24 comparisons for every single pixel in the display. This way the comparisons are limited to 5. In my integrated Intel graphics, it's much more responsive when I move the mouse.