[cairo] cairo_set_dash performance
cu
cairouser at yahoo.com
Thu Feb 5 20:39:36 PST 2009
Thanks for the reply, this seems promising but could you elaborate on a
few points (sorry, I am being dense).
1) when you talk about dashed area vs. "small portion being rendered"
does this apply to other shapes?
I.e. if I have a long line describing what would appear as a polygon,
but only draw it as an outline - it would be better to not "close" the
shape (cairo_close_path at the end) but rather split the line into a few
shorter pieces and draw each one separately?
2) I actually switched from integer to double values just recently - I
wonder if this has any effect. Will switch back and retry :) All the
dash patterns are described with whole numbers, no fractions (but I
wonder if this matters for lines that are not axis aligned?)
> Dashes compared to normal lines are pretty expensive, especially if the
> lines were always pixel aligned (and resulted in pixel aligned regions
> being filled). There are some things you can do, though:
>
> 1) If you're drawing something like a dashed rectangle, where there's a
> large surface area but only a small portion of it is actually rendered
> to, you can often get better performance by drawing each side
> separately. (I don't know if this is still the case with the scanline
> rasterizer.)
>
> 2) Try to ensure that your dash patterns all result in pixel aligned
> dashes; effectively this means that your lines must start/end on integer
> pixels (and fully fill those pixels), and that the dash pattern should
> be composed of integers only. All gets thrown out the door if you have
> scaling/rotation/etc. going on, though.
>
> - Vlad
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
More information about the cairo
mailing list