Out of curiosity: Do you use a high level language (like C#) or do you have low level optimizations on (e.g. assembly level)?
I imagine that there has to be some kind of map that keeps track of which pixels are "active" and need to be updated, but I wonder how do that efficiently.