[cairo] After 'set_line_width', subsequent stroking is slow
olivier.jolet at skynet.be
Thu Feb 22 06:54:28 PST 2007
> > > > > 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.
Here is the application reduced. The important part (the graphics
interpreter) is in the hello.c file in the 'cairo_draw' function. The
performances are really different with/out the primitive
cairo_set_line_width (line 175) and using antialiasing or not.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 82463 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070222/8a4b224b/Sample.tar-0001.obj
More information about the cairo