phoboslab/Ejecta — pull request #20 by Tharit (2012-10-06 16:53:31+00:00)
Title: improved performance when stroking transparent lines

I did a small change to the stencil buffer usage in stroke.
By rotating through the 7 highest bits, it is enough to only do one glClear after 7 strokes, instead of after one. As `fill` only uses the lowest bit, and always resets all used pixels to zero, this change has no effect on the behaviour of `fill`.

Performance goes up from 3 fps to 16fps in the index.js with 4xMSAA and 200 curves on my ipad3.

For other cases an interesting further optimization might be to also compute the bounds of all 7 stroked paths, join them, and push a rect instead of doing a clear.. when only small areas of the screen are affected, that might help :)