[cairo] clip stack composition performance

Alexander Larsson alexl at redhat.com
Fri Jun 10 01:33:33 PDT 2005

Poppler with cairo is very slow at rendering this file:

It turns out that a lot of the time is spent in the general compositor
code doing PIXMAN_OPERATOR_IN on the a8 clip masks when clip regions are
stacked on top each other.

Just for fun I added some special case code for a8 IN operations to
libpixman, see attached (not very well tested) patch. (Although owen
said I shouldn't touch the libpixman compositing code until the new
compositing code from the X server is merged...)

It makes quite a difference rendering the pdf, but its still sort of
slow. The main thing making it slow seems to be the poppler image
rendering code (25% or so) and the fact that non-pixel-aligned clipping
rects make all rendering use/create large clip masks. This poppler
badhack makes it much faster:

diff -u -p -r1.14 CairoOutputDev.cc
--- poppler/CairoOutputDev.cc   26 May 2005 13:03:35 -0000      1.14
+++ poppler/CairoOutputDev.cc   10 Jun 2005 08:24:53 -0000
@@ -327,7 +327,7 @@ void CairoOutputDev::eoFill(GfxState *st
 void CairoOutputDev::clip(GfxState *state) {
-  doPath (state, state->getPath(), gFalse);
+  doPath (state, state->getPath(), gTrue);
   cairo_set_fill_rule (cairo, CAIRO_FILL_RULE_WINDING);
   cairo_clip (cairo);
   LOG (printf ("clip\n"));

 Alexander Larsson                                            Red Hat, Inc 
                   alexl at redhat.com    alla at lysator.liu.se 
He's a suicidal misogynist househusband from a doomed world. She's an orphaned 
antique-collecting schoolgirl with a birthmark shaped like Liberty's torch. 
They fight crime! 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libpixman-clip-compositing.patch
Type: text/x-patch
Size: 3759 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050610/53da366d/libpixman-clip-compositing.bin

More information about the cairo mailing list