[cairo] After 'set_line_width', subsequent stroking is slow [ Background image]

Carl Worth cworth at cworth.org
Wed Feb 21 07:12:53 PST 2007

On Wed, 21 Feb 2007 12:28:05 +0000, Baz wrote:
> On 21/02/07, Olivier Jolet <olivier.jolet at skynet.be> wrote:
> > > > On 2/20/07, Olivier Jolet <olivier.jolet at skynet.be> wrote:
> > > > > Also, I have another problem of performance, if I use the
> > > > > 'cairo_set_line_width' primitive, it is very much slower. I don't
> > > > > understand why there is a such difference?
> Just watching from the sidelines... if you don't set the line_width,
> then the pen will just be a point and I believe you are going to hit
> an optimisation at line 877 of cairo-path-stroke.c (in
> _cairo_stroker_curve_to_dashed)

I don't think so. That's an optimization based on whether you are
doing dashing or not.

Another possibility is that the difference is due to the recent
rectilinear stroking optimizations. If Olivier is just drawing
axis-aligned linear paths, (no curves), then the default line width of
2.0 will make the stroked outline align with device-pixel boundaries
and allow the optimization to kick in.

If the change in line width is to a non-integer (or an odd integer)
then the stroked outline won't hit those device-pixel boundaries
anymore and cairo will have to start taking a bunch more time to
compute the "blurred" edges, (which might not be desired anyway).

But again, we're really just guessing here until we see something more
concrete on what cairo calls the code is actually making.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070221/24a74926/attachment.pgp

More information about the cairo mailing list