[cairo] odd line widths are slow
Benjamin Otte
otte at redhat.com
Tue Aug 3 13:52:04 PDT 2010
You probably want cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE), too.
You need to be aware that points on a path describe the center of a
line. So if you draw a line from 0,0 to 10,0 with a line width of 2 and
a line cap of square, it'll result in a rectangle from -1,-1 to 11,1.
And if you draw with a line with line width of 3, it'll go from
-1.5,-1.5 to 11.5,1.5.
And the moment you're not pixel aligned on the output anymore, stuff
goes noticably slower.
Benjamin
On Tue, 2010-08-03 at 16:22 -0400, Cliff Brake wrote:
> On Tue, Aug 3, 2010 at 3:51 PM, Bill Spitzak <spitzak at gmail.com> wrote:
> >
> >
> > Cliff Brake wrote:
> >>
> >> On Tue, Aug 3, 2010 at 3:03 PM, Bill Spitzak <spitzak at gmail.com> wrote:
> >>>
> >>> Translate by .5,.5 before drawing odd line widths so they are aligned
> >>> with
> >>> the pixels?
> >>
> >> Would adding 0.5 to x/y before drawing have the same affect as translate?
> >
> > Yes
>
> We tried that and it did not impact the performance. I am working to
> upgrade our cairo/pixman libs now, and will try again with updated
> libs.
>
> Thanks,
> Cliff
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
More information about the cairo
mailing list