[cairo] Alpha-blending performance: looking for bottlenecks in my code
Damian Frank
damian.frank at gmail.com
Wed Mar 25 15:05:27 PDT 2009
I'm trying to figure out why my code using Cairo is as slow as it is,
and I could use some help. Odds are, I'm falling off the fast path or
something, but I can't see how.
In a very simple sample app, I create a 300x300 RGBA image surface,
then repeatedly do the following:
cairo_set_source_rgb(1, 1, 1);
cairo_fill();
<start timing>
cairo_set_source_rgba(0, 0, 1, alpha);
cairo_new_path();
cairo_rectangle(20, 30, 256, 256);
cairo_fill();
<stop timing>
This is on a reasonably fast win32 machine. I find that if alpha ==
1, this averages .028ms per pass. But if alpha == 0.5, this averages
2.25ms per pass. Using RGB24 instead of ARGB32 doesn't help. I find
this surprisingly slow, especially for a solid color. Am I doing
something wrong, or am I just expecting too much?
Thanks,
Damian
More information about the cairo
mailing list