[cairo] [Cairo]Recording suface performance
Andrea Canciani
ranma42 at gmail.com
Mon Feb 21 02:34:15 PST 2011
On Mon, Feb 21, 2011 at 10:05 AM, hyeonji Kim <hyeonji1021 at gmail.com> wrote:
> Hi,
> I'm developer of mobile browser using webkit with cairo library.
> I did performance comparing test between recording surface and image surface
> with cairo 1.10.2.
> The performance(paint time) of recording surface seems quite low.
> I doubt the testing code maybe written wrong and if the test code is right,
> I want to know why the recording surface performance is low.
Profiling would probably point out where the slowdown come from.
My guess is that the cairo_paint() is creating a snapshot so that
further cairo_paint using that same source will be faster (as fast as
painting from an image surface).
This would explain a slowdown up to 3x (create snapshot, copy src_surface
to snapshot, then finally perform the "true" paint, each being basically a
memcpy/memset on a memory region as big as the image).
>
> I'd appreciate if you explain how recording surface works when
> cairo_paint(dst_cr); is called in recording_surface().
It creates a snapshot of the current source pattern and adds an
element to the list of operations to be performed when the surface
is replayed (i.e. it "records" the operations it receives).
> When the operations "replay" for recording surface?
Conceptually, the list of operations is applied on the destination surface.
In practice, this is usually performed by creating an image snapshot of the
recording surface, to be used instead of replaying the whole recording
surface.
> Why cairo_paint(dst_cr) time is different in recording_surface() and
> image_surface()?
They perform different operations, they use different amounts of time.
> I wonder the advantage of recording surface over image surface.
Recording surfaces are vector surfaces.
Image surfaces are raster surfaces.
Andrea
More information about the cairo
mailing list