[cairo] Survey of polygon rasterization techniques

Zack Rusin zack at kde.org
Tue Jul 31 03:24:12 PDT 2007

On Tuesday 31 July 2007 05:19:40 am you wrote:
> Hello Zack,

Hey David,

> > Rendering to QImage (or just rendering on Qt/Windows) invokes software
> > rasterizer that is a mixture of freetype2/agg rasterization techniques
> > and  should be faster than both.
> Could you elaborate on this "should be faster than both" ? I'm interested
> to know what kind of improvement you made.
> I just had a quick look at src/gui/painting/qgrayraster.c in Qt 4.3 and
> I don't see much differences from a relatively old version of the
> FreeType anti-aliasing rasterizer. Maybe some details escape me ?

The thing that made a noticeable difference for us was adding a y coordinate 
to the spans. This made it possible to generate more spans in one go (we 
increased the FT_MAX_GRAY_SPANS from 32 to 256). It made a big difference for 
smaller polygons where function call overhead was actually dominating the 
profile. I'm not sure whether that patch makes a lot of sense for FreeType 
main, but if you're interested I could extract the patches and send them to 
you sometime this week.

> Also, you may find interesting that the current FreeType rasterizer sources
> use a scanline-bucket scheme now, instead of QSort, to sort the cells. I've
> done this because in some relatively common cases, it provided a x1.25
> speedup in rendering time.

Ah, sounds very interesting. Thanks!


More information about the cairo mailing list