I was looking for an algorithm to draw filled triangles, I found one from Adafruit's Graphics library, but I kept on looking for something more efficient. I found some code from http://www.sunshine2k.de/
, it is based on the Bresenham's line algorithm and I optimized a bit further.
I have found that the Bresenham's algorithm, besides being more efficient (at least on a microcontroller), draws the triangles more accurately, particularly when drawing sharp edges.
Attached is the code for anyone interested.
Perhaps the Adafruit team can test the algorithm and check if it is any good and consider adding it to the library...