[cairo] Getting started
behdad at cs.toronto.edu
Mon Jul 25 03:07:45 PDT 2005
On Mon, 25 Jul 2005, Vladimir Vukicevic wrote:
> Ah, sorry, I misunderstood -- when you mentioned that you were gettig
> two-pixel-wide blurred lines I assumed you were drawing individual
> lines. I think you want to translate by +0.5,+0.5 instead of
> -0.5,-0.5, though I don't think that would explain the slowdown (just
> maybe an off-by-one in your rendered output). Other than that, I'm
> not really sure what to suggest, other than maybe stepping through
> cairo_stroke() and seeing where you deviate from the optimized paths
> (usually indicated in comments).
Thanks. I managed to get an acceptable performance by doing:
- Do not translate.
- For drawing lines, set width to 1 and add +0.5,+0.5 to all
- When drawing filled stroked rectangles, do not use the same
path for both fill and stroke. Use integer coordinates for the
fill, and half-off coordinates for the stroke. This is the only
way to avoid alpha-blending.
I wish there was a way to have a fill+stroke to use the same path
and still be fast, but I that's only an issue with axis-aligned
I'll be adding these to the FAQ tomorrow.
> - Vlad
More information about the cairo