[Pixman] [cairo] Pixman centre pixel sampling in unantialiased mode.
Soeren Sandmann
sandmann at daimi.au.dk
Wed Feb 24 22:22:55 PST 2010
Carl Worth <cworth at cworth.org> writes:
> On 17 Nov 2009 08:17:53 +0100, Soeren Sandmann <sandmann at daimi.au.dk> wrote:
> > A consequence of changing the rounding is that on an a1 surface, this:
> >
> > cairo_move_to (cr, 1, 1);
> > cairo_line_to (cr, 50, 1);
> > cairo_stroke (cr);
> >
> > will now cause the 0th row of pixels to be illuminated, where before
> > it would illuminate the 1st row. This is correct behavior according to
> > how cairo interpretes coordinates, but it may be surprising and of
> > course it breaks the test suite.
>
> What's the rationale for "correct behavior according to how cairo
> interprets coordinates"? Do we have a writeup somewhere of how cairo
> breaks the tie when a sample point is coincident with a geometry
> edge?
Well, it's correct according to the combination of top/left considered
inside, bottom/right outside and cairo's putting sample points at half
integers.
> > Reviews appreciated, as are comments on whether changing the rounding
> > rules to be more consistent is worth changing the tests and
> > potentially surprising users.
>
> I like consistent. I don't think it's reasonable to have a graphics
> library with inconsistent rules for things like this. There should be a
> rule, it should be documented, and deviation from it should be
> considered a bug and be fixed.
>
> Meanwhile, I would *hope* that users are placing their geometry edges
> centered between A1 sample points rather than directly on them. (But
> with A1, who knows---maybe they just fiddled until they got the result
> they wanted.)
>
> I'm willing to take this change and update the test suite, (assuming
> consistency with a documented rule as a I described). As for how to
> reduce the potential surprise to users---that's a tough thing to
> predict. Let's try it and find out, perhaps?
The fixes are merged now. They are in pixman 0.17.8, and there is also
a regression test there. So at the moment, if you run cairo's test
suite against 0.17.8, it will fail various a1 tests.
Soren
More information about the Pixman
mailing list