[cairo] Recording commands and playing back?

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 27 00:33:31 PDT 2010


On Mon, 26 Apr 2010 16:55:20 -0700 (PDT), Stuart Axon <stuaxo2 at yahoo.com> wrote:
> My limited understanding is that meta surfaces can be used to record commands that I can playback later...
> 
> I can't see anything like this in pycairo... is it just not available here, or is it a case of waiting for 1.10 ?

In 1.10, the previously private cairo_meta_surface_t becomes the public
cairo_recording_surface_t and does exactly what you: record commands for
later playback to another target surface.

Prior to 1.10, you can actually use a PDF surface with a nul stream to
achieve the same result.

> Also - is there much of a performance penalty in doing this ?

Of course. All sources are copied to an image surface upon use as well the
overhead of simply recording the paths. In 1.10, we have zero copy
snapshotting -- that is the recording surface will only make a image
surface copy of the source if it is later modified or freed.

The other impact is that you are no longer an immediate mode renderer,
which may have be detrimental to your latency.

However, the appeal of a deferred mode renderer is that we could perform
analysis to remove overdraw which could have a large performance increase
in some complicated drawings, like many SVG examples.

You will have to experiment for yourself, I am afraid. We would love to
hear the outcome, though!

Have fun with Cairo!
-ickle

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list