Friday, May 8, 2015

Keep it simple

 unsigned char alphaValue = GetAlphaValue(pixelIndex);  
 if (alphaValue > 250)  
 if (alphaValue < 5)  

The above code is a trivial optimization for a 2D software renderer I currently write for a course I'll be giving at my old university.

At one point I was thinking of mulithreading the rasterization but those 5-ish lines saved me from all the work.

Sometime you just got to keep it simple.


I agree that this solution may be suboptimal for most users - however it is perfectly applicabale for the university project.