[cairo] After 'set_line_width',
subsequent stroking is slow [ Background image]
brian.ewins at gmail.com
Wed Feb 21 04:28:05 PST 2007
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
The description of the slow path says:
/* We're using two different algorithms here for dashed and un-dashed
* splines. The dashed algorithm uses the existing line dashing
* code. It's linear in path length, but gets subtly wrong results for
* self-intersecting paths (an outstanding but for self-intersecting
* non-curved paths as well). The non-dashed algorithm tessellates a
* single polygon for the whole curve. It handles the
* self-intersecting problem, but it's (unsurprisingly) not O(n) and
* more significantly, it doesn't yet handle dashes.
... and goes on to describe a fix that needs to be done.
If this is the problem it's going to show up as time spent in
_cairo_stroker_curve_to_dashed in the profile for curve drawing only.
Not that this is much help to you - it sounds like this is the
problem, but I don't know of a workaround.
More information about the cairo